Linker error not related to Linker
This question already has an answer here:
Your error occurs because of C++ type-safe linkage, which mangles function names. You need to tell the C++ compiler that the function()
has C linkage:
extern "C" void function(void);
However, if the same header should be used by both the C and C++ compilers, you normally do that by using
#ifdef __cplusplus
extern "C"
#endif
void function(void);
for a single function declaration, or use
#ifdef __cplusplus
extern "C" {
#endif
void function(void);
int response(int arg);
…
#ifdef __cplusplus
}
#endif
around a block of function declarations for functions with C linkage.
You can also use your existing header in C, and in your C++ code, use:
extern "C" {
#include "header.h"
}
链接地址: http://www.djcxy.com/p/40496.html
上一篇: 在IE8中应用css渐变过滤器时,表格单元格会丢失边框
下一篇: 链接器错误与链接器无关