VS命令提示符下的winnt.h错误

时间:2011-08-21 23:12:26

标签: windows visual-studio visual-studio-2008 scons

我正在尝试使用NSIYSA(http://code.google.com/p/nixysa/)开发NPAPI插件,该插件使用Scons构建项目。现在我只是想构建Hello World示例应用程序。 问题是,在生成C源文件后,编译时会遇到奇怪的winnt.h错误。 下面是它使用的命令和结果:

c:\Users\Mo\Documents\Projects\Chrome Plugin\nixysa-read-only\examples\hel
lo_world>"c:\Program Files (x86)\Microsoft Visual Studio 9.0\vc\bin\cl" /Foglue\
globals_glue.obj /c glue\globals_glue.cc /TP /nologo /DWIN32 /DOS_WINDOWS /I. /I
 "C:\Users\Mo\Documents\Projects\Chrome Plugin\nixysa-read-only\nixysa\sta
tic_glue\npapi" /I "C:\Users\Mo\Documents\Projects\Chrome Plugin\nixysa-re
ad-only\third_party\npapi\include" /Iglue
globals_glue.cc
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(6361) : error C2146
: syntax error : missing ';' before identifier 'ContextRecord'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(6361) : error C4430
: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(6361) : error C4430
: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(12983) : error C206
5: 'PCONTEXT' : undeclared identifier
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(12984) : error C214
6: syntax error : missing ')' before identifier 'ContextRecord'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(12984) : warning C4
229: anachronism used : modifiers on data are ignored
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(12984) : error C218
2: 'RtlCaptureContext' : illegal use of type 'void'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(12984) : error C249
1: 'RtlCaptureContext' : definition of dllimport data not allowed
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(12984) : error C205
9: syntax error : ')'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(13372) : error C214
3: syntax error : missing ';' before '__stdcall'
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(13372) : error C443
0: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(13376) : error C443
0: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft SDKs\Windows\v7.0\include\winnt.h(14982) : error C386
1: '__readfsdword': identifier not found
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : war
ning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc

我搜索了很多,建议的唯一解决方案是当DXSDK标头引起冲突时,应在稍后的include目录列表中提及它们。我安装了DXSDK,但include目录不在我的VS9列表中,也不在VS 2008命令提示符的“vcvars32.txt”中。

定义VS命令提示符变量的四行是:

@set PATH=%DevEnvDir%;%VCINSTALLDIR%\BIN;%VSINSTALLDIR%\Common7\Tools;%VSINSTALLDIR%\Common7\Tools\bin;%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%Framework35Version%\Microsoft .NET Framework 3.5 (Pre-Release Version);%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\VCPackages;%PATH%
@set INCLUDE=%INCLUDE%;%VCINSTALLDIR%\INCLUDE;%VCINSTALLDIR%\ATLMFC\INCLUDE
@set LIB=%VCINSTALLDIR%\ATLMFC\LIB;%VCINSTALLDIR%\LIB;%LIB%
@set LIBPATH=%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\ATLMFC\LIB;%VCINSTALLDIR%\LIB;%LIBPATH%

在VS命令提示符下,我得到以下echo%INCLUDE%:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE;C:\Program
Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE;C:\Program Files\Microsoft SD
Ks\Windows\v7.0\include;

我在命令提示符下使用cl.exe命令(使用nixysa脚本),在VS命令提示符下,两者都给出了相同的错误。 我不认为生成的C代码有任何问题,因为它是未经编辑的Hello World,基本上已经过测试,其他人似乎没有问题。

那么任何想法?问题可能在winnt.h中,它正在使用或?

更多信息:在Intel Core 2 Duo上赢得7 x64

1 个答案:

答案 0 :(得分:3)