我正在为Windows 7 x64 SUA / Interix的64位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).
我不明白原因是什么......使用long
就像在GCC中使用64位一样令人困惑,但错误更令人困惑!想法?
答案 0 :(得分:12)
在代码的某处,somone可能会这样做:
#define size_t unsigned long
或类似的东西,当他们这样做时没有定义_SIZE_T_DEFINED
。然后他们的代码#include
s stddef.h
通过您的错误消息中列出的路径。这使您的错误行看起来像:
typedef unsigned long unsigned long;
编译器,这是行不通的!