简体   繁体   English

当我使用cygwin gcc时,typedef defenition错误

[英]typedef defenition error when I use cygwin gcc

It is my first experience with cygwin gcc, before that I used it on linux. 这是我第一次使用cygwin gcc,之前我在linux上使用它。 I faced a problem solution for which I failed to find in net. 我遇到了一个我在网上找不到的问题解决方案。

I want to compile C source file and have included this source 我想编译C源文件并包含此源

// Value type defenitions
// --- chars --- //
typedef unsigned char UChar;
typedef char Char;
// --- short int --- //
typedef unsigned short UShort;
typedef short  Short;
// --- int --- //
typedef unsigned int UInt;
typedef int Int;
// --- long int --- //
typedef long  Long;                             // 32 bits length
typedef unsigned long  ULong;                   // unsigned 32 bits length
// --- long long int --- //
typedef unsigned long long  UBig;               // 64-bit length unsigned 
typedef long long Big;                          // 64-bit length
// --- decimals --- //
typedef float Float;
typedef double Double;
typedef long double Triple;    // 80-bit length. Actual   properties unspecified. 

and have got this error 并且有这个错误

Include/null.h:6: error: redefinition of typedef 'UChar'
Include/null.h:6: error: previous declaration of 'UChar' was here
Include/null.h:7: error: redefinition of typedef 'Char'
Include/null.h:7: error: previous declaration of 'Char' was here
Include/null.h:9: error: redefinition of typedef 'UShort'
Include/null.h:9: error: previous declaration of 'UShort' was here
and so on...

Thank you for help! 谢谢你的帮助!

Looks like you have included the same header, where you have typedef'edthese, more than once. 看起来你已经包含了相同的标题,你有不止一次的typedef'edthese。 Use include guards to avoid multiple inclusion. 使用包含警戒以避免多次包含。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM