Qt 交叉编译经典错误――头文件包含

匿名 (未验证) 提交于 2019-12-02 23:55:01

 

分析:

包含我在某个C头文件中包含了C++

 

#ifdef __cplusplus //bsp_GPIO.h  .c 被 cpp文件引用,需要如此添加 extern "C" { #endif //----------本文件需要引出的函数----------// int GPIO_OutEnable(int fd, unsigned int dwEnBits); int GPIO_OutDisable(int fd, unsigned int dwDisBits); int GPIO_OpenDrainEnable(int fd, unsigned int dwODBits); int GPIO_OutSet(int fd, unsigned int dwSetBits); int GPIO_OutClear(int fd, unsigned int dwClearBits); int GPIO_PinState(int fd, unsigned int* pPinState); int GPIO_IrqEnable(int fd, unsigned int dwEnBits); #ifdef __cplusplus } #endif

 

注:C文件不可以引用C++文件,在现实当中,只能够在C++里面引用c文件,不可以在C中引用CPP文件,除非你的CPP文件里完全是使用C写的代码。子集要用超集,这从逻辑上是不成立的.

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!