加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Linux下编程时的conflicting types for 'dev_t'问题

发布时间:2013-06-14 11:29:17 所属栏目:Linux 来源:站长网
导读:在Linux下编译程序有时会遇到这种问题,这貌似是一个Linux历史遗留问题: /usr/include/sys/types.h:62: error: conflicting types for dev_t /usr/include/linu
在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>

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读