#pragma once
#ifdef __cplusplus//两个_下划线
extern "C" {
#endif //! __cplusplus
#include
void show();
#ifdef __cplusplus//两个_下划线
}
#endif //! __cplusplus
头文件
#define _CRT_SECURE_ND_WARNINGS #includeusing namespace std; #include "text.h" //c++中想调用C语言方法 //extern "C" void show();//show方法 按照C语言方式做连接 //解决的问题就是 在c++中调用C语言的函数 int main() { show();//在C++中函数是可以发生重载的,编译器会把这个函数名称偷偷改变 ——showv void //这里会报错 无法解析外部符号 system("pause"); return EXIT_SUCCESS; }
c++文件
#include "text.h"
void show()
{
printf("hello world n");
}
c语言文件



