c++ c 混合编程的 undefined reference问题

使用C++编程时,有时要用到第三方的库,而第一方库是以C给出的,奇怪的是明明已经把C文件加入工程,头文件也已经引入,编译里仍是出现编程

undefined reference编译

问题在这里,第三方的C库的头文件没有加入extern "C",在C文件的头文件加入以下便可di

#ifdef  __cplusplus   文件

extern "C" {   undefined

#endif  

/* C头文件的其它声明 */

 

#ifdef  __cplusplus  

}  

#endif  /* end of __cplusplus */

相关文章
相关标签/搜索