2011-09-07 93 views
22

编译winbase.h时出现以下Windows文件错误。在'winbase.h'中编译错误

不知道为什么我得到一个语法错误和编译器显示更多:

1> c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(238) : 
    error C2146: syntax error : missing ';' before identifier 'Internal' 

这里一个简单的代码来重现问题:

#include <winbase.h> 

int main() 
{ 
    return 0; 
} 
+6

看来你错过了一个分号。 – Falmarri

+3

你可以请张贴一些代码吗?只有这个错误,很难知道什么是错的。 – templatetypedef

+3

您可能在(in)直接包含“winbase.h”之前错过了一个分号。 – Mysticial

回答

47

您是否直接包含<winbase.h>

你不应该 - 它希望在处理之前定义/声明一些东西。特别是在这种情况下,在intsafe.h中声明为typedef的标识符ULONG_PTR

包括<windows.h>

3

你可能丢失之前;立即代码中的#include <windows.h>行。或者,包含文件行之前有一些类似标识符的文本。

int ABC 
#include <windows.h> 
1

如果你的代码没有问题,并且#include "winbase.h"之前没有丢失分号,那么它应该是在winbase.h(或包含它的文件之一)之前缺少的包含。