为什么你会用'的extern" C ++"'? [英] Why would you use 'extern "C++"'?
本文介绍了为什么你会用'的extern" C ++"'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此文章关键字的extern可以遵循 C或C ++。为什么你会使用'的externC ++?是否实用?
In this article the keyword extern can be followed by "C" or "C++". Why would you use 'extern "C++"'? Is it practical?
推荐答案
语言许可证:
extern "C" {
#include "foo.h"
}
如果foo.h中含有一种需要C ++联动呢?
What if foo.h contains something which requires C++ linkage?
void f_plain(const char *);
extern "C++" void f_fancy(const std::string &);
这是你如何保持连接开心。
That's how you keep the linker happy.
这篇关于为什么你会用'的extern" C ++"'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文