我正在編譯用於Windows 7 x64 SUA/Interix的64位GCC編譯器grep
。stddef.h:錯誤:重複'unsigned'
它扼流圈在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位一樣,但錯誤更令人困惑!想法?
看起來好像long已經被#defined unsigned包含在前面的某個地方。 – 2012-01-11 21:51:00
有沒有可能'size_t'被預先定義爲一個宏,比如'#define size_t unsigned int'或其他,但是'_SIZE_T_DEFINED'沒有被定義?然後,有問題的行將等同於'typedef unsigned long unsigned int;'(或類似的),這將觸發該錯誤消息。 – ruakh 2012-01-11 21:51:48
你們絕對是對的:)感謝指針,這真是令人費解。 – Mehrdad 2012-01-11 21:53:59