编程语言
首页 > 编程语言> > c++ 的学习 extern _cplusplus

c++ 的学习 extern _cplusplus

作者:互联网

1.◼ 有时也会在编写C语言代码中直接使用extern “C” ,这样就可以直接被C++调用

如果是c++ 但是你看不到

2.宏定义

3.

 

 接着上面总结,最好在main.h之中也 #include “main.h”

不然你在main.c中函数实现中的引用会报错

int delta(int v1, sum(v1,v2))

4.

 

 

 01.就是vs  隐藏cplusplus  这个宏定义,其实它是存在的

02.就是写的

03.就是能不能实现这个extern “C”{}

设计判断如果是c++就执行extern “C”{}

5.

 

 

 6.对于 other.c 来讲 的话

 

 

上面的extern “C”{}  可以直接换成#include “main.h”

因为你没有在头文件里面加定义   viod other()

所以你在main.cpp,之中得加

 

 

声明extern “C”{

 viod other(int a,int b)}

main{}函数里面加实现other()

 

或者说直接在main.h头文件里面添加,声明即可

 

标签:int,cplusplus,c++,other,extern,main
来源: https://www.cnblogs.com/a-hhxx/p/15342556.html