在Linux下编译程序有时会遇到这种问题,这貌似是一个Linux历史遗留问题:
/usr/include/sys/types.h:62: error: conflicting types for ‘dev_t’
/usr/include/linux/types.h:13: error: previous declaration of ‘dev_t’ was here
/usr/include/sys/types.h:67: error: conflicting types for ‘gid_t’
开始以为是GCC的版本问题,升级了版本也不好使,后来发现!进入编译出错的文件xxx.cpp:
把所有#include <sys/xxx.h>都提到最前面,把#include <linux/xxx.h>的包含放在其后,就可以编译通过了,之所以出现面的问题是存在循环引用所致。如:
#include <linux/apm_bios.h>
#include <sys/types.h>
变成
#include <sys/types.h>
#include <linux/apm_bios.h>
最后
以上就是紧张树叶最近收集整理的关于conflicting types for 'dev_t'的原因的全部内容,更多相关conflicting内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复