我正在Windows7 x64 SUA/Interix64位的GCC编译器上编译grep。
它在stddef.h中标记的行上阻塞
#ifndef _SIZE_T_DEFINED
#if defined (lp64) || defined(_WIN64)
#ifdef lp64
typedef unsigned long size_t; // <------ error
#else /* lp64 */
typedef unsigned __int64 size_t;
#endif /* lp64 */
#else /* (defined(lp64) || defined(_WIN64)) */
typedef unsigned int size_t;
#endif /* (defined(lp64) || defined(_WIN64)) */
#define _SIZE_T_DEFINED
#define _SIZE_T
#endif /* _SIZE_T_DEFINED */make的输出为:
make all-recursive
Making all in intl
gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" -DIN_LIBINTL -DHAVE_CONFIG_H -I.. -I. -I../../intl -D_ALL_SOURCE -D_REENTRANT -I/usr/local/include -I/usr/local/include -D_ALL_SOURCE -D_REENTRANT ../../intl/intl-compat.c
In file included from ../../intl/gettextP.h:23:0,
from ../../intl/intl-compat.c:25:
/usr/include/stddef.h:50:23: error: duplicate 'unsigned'
*** Error code 1
Stop in /tmp/grep-2.5.4-src/build/intl.
*** Error code 1
Stop in /tmp/grep-2.5.4-src/build (line 329 of Makefile).
*** Error code 1
Stop in /tmp/grep-2.5.4-src/build (line 244 of Makefile).我不明白原因是什么。在GCC中使用long就好像它是64位的,这已经很令人困惑了,但这个错误更令人困惑!想法?
发布于 2012-01-12 05:50:48
在您的代码中,可能有人这样做了:
#define size_t unsigned long或者类似的东西,在他们这样做的时候没有定义_SIZE_T_DEFINED。然后他们的代码通过你的错误信息中列出的路径#includes stddef.h。这使得你的错误行看起来像这样:
typedef unsigned long unsigned long;对编译器来说,这是行不通的!
https://stackoverflow.com/questions/8827150
复制相似问题