报错如下:
/opt/compiler/glibc-oabi-toolchain-arm-generic/arm-unknown-linux-gnu//sys-root/usr/include/sys/types.h:151: error: duplicate 'unsigned'
/opt/compiler/glibc-oabi-toolchain-arm-generic/arm-unknown-linux-gnu//sys-root/usr/include/sys/types.h:152: error: duplicate 'unsigned'/opt/compiler/glibc-oabi-toolchain-arm-generic/arm-unknown-linux-gnu//sys-root/usr/include/sys/types.h:153: error: two or more data types in declaration specifiers
总算找到根本原因了:
#include<sys/types.h>
头文件包含这个啦,这个你去掉就可以了,不去掉就用下面的规避方式就可以解决。
规避方法一:
/*屏蔽掉和工具链里面的重复定义,因为工具链中默认让宏定义__USE_MISC生效*/
#ifndef __USE_MISC
#ifndef uint
#define uint unsigned int
#endif
#ifndef ulong
#define ulong unsigned long
#endif
#ifndef ushort
#define ushort unsigned short
#endif
#endif
规避方法二:直接屏蔽掉
#ifdef __USE_MISC
/* Old compatibility names for C types. */
//typedef unsigned long int ulong;
//typedef unsigned short int ushort;
//typedef unsigned int uint;
#endif