..\vc98\include\windef.h(43) : error C2632: long followed by long is illegal
..\vc98\include\windef.h(43) : error C2632: "long" followed by "long" is illegal
楼主stzhou(阿毛)2002-11-22 17:38:45 在 VC/MFC / 基础类 提问 错误提示VC的头文件windef.h中的这一句有问题,怎么办?
typedef unsigned long ULONG;
问题点数:80、回复次数:3Top
1 楼rtdb(东临碣石)回复于 2002-11-22 18:25:12 得分 30
检查你的头文件,
可能最后少},; #endif 之类的.Top
2 楼cbc(逍遥子)回复于 2002-11-22 18:32:56 得分 50
From MSDN:
CAUSE
This error occurs as a result of MFC using STRICT type checking by default. STRICT type checking is not used in WINDOWS.H unless you define STRICT as a preprocessor symbol before including the header file.
Specifically, WINDOWS.H has the following statement:
#ifdef STRICT
typedef signed long LONG;
#else
#define LONG long
#endif
AFX.H has this statement:
typedef long LONG; // 32-bit signed number
As you can see, if STRICT type checking is not used and WINDOWS.H is included before AFX.H, the typedef statement in AFX.H becomes the following (after preprocessing):
typedef long long; // 32-bit signed number
The typedef statement is used to create another name for an existing data type. Because this statement has not specified a different name for the long data type, it is disallowed by the compiler.
RESOLUTION
Include WINDOWS.H after the MFC header files or not at all. AFXWIN.H automatically includes WINDOWS.H, so it is normally not necessary to explicitly include it in your source code.
Another way to avoid this error is to define STRICT as a preprocessor symbol before including WINDOWS.H. This will ensure that LONG is type defined as signed long rather than simply long.
MORE INFORMATION
MFC Technical Note 12 "Using Windows 3.1 Robustness Features" contains additional information on STRICT type checking and other Windows 3.1 robustness features.
Sample Code
/* Compile options needed: /D_WINDOWS */
/*
#define STRICT // Remove comments from this line to avoid errors.
*/
#include <windows.h> // Or, reverse order of these statements.
#include <afx.h>
Top
3 楼JennyVenus()回复于 2002-11-22 18:55:33 得分 0
agree with rtdb(东临碣石)Top
-
相关文章
2秒记住本站域名
玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的readygo.com.cn
