C调用C++示例代码及方法简述
1. C++代码及C主进程代码 c++程序代码test.cc
1 2 3 4 5 6 7 |
//test.cc #include "test.h" #include <iostream> using namespace std; void fun(){ std::cout<<"Execute C++ fun!"<<std::endl; } |
头文件test.h这个文件为C代码直接调用头文件,不要存在任何C++相关代码; 添加宏定义#ifdef __cplusplus extern "C" { #endif 便于在c和c+… 阅读更多 »C调用C++示例代码及方法简述