VS 命令提示符上的 winnt.h 错误
我正在尝试使用 NIXYSA (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 标头引起冲突时,它们应该稍后在包含目录列表中提及。我确实安装了 DXSDK,但包含目录不在 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;
我在命令提示符(使用 nixysa 脚本)和 VS 命令提示符中都运行了 cl.exe 命令,两者都给出了相同的错误。 我认为生成的 C 代码没有任何问题,因为它是未经编辑的 Hello World,基本上已经过测试,而其他代码似乎没有问题。
那么有什么想法吗?问题可能出在它正在使用的 winnt.h 中吗?
更多信息:Intel Core 2 Duo 上的 Win 7 x64
I'm trying to develop an NPAPI plugin using NIXYSA (http://code.google.com/p/nixysa/) which uses Scons for building the project. Now I'm just trying to build the Hello World sample app.
The problem is that, after generating the C source files, it runs into weird winnt.h errors when compiling.
Below is the command it uses and the result:
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
I've searched pretty much and the only solution that is suggested is for when the DXSDK headers cause conflict and they should be mentioned later in the list of include directories. I do have DXSDK installed, but the include directories aren't in the list for my VS9, nor in the "vcvars32.txt" of VS 2008 command prompt.
The four lines defining the variables of the VS command prompt are :
@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%
In VS command prompt I get the following for 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;
I ran the cl.exe command both in command prompt (using the nixysa script) and in VS command prompt, both gave the same errors.
I don't think there's any problems in the generated C code, since it's the unedited Hello World which is basically tested and others don't seem to be having problem with.
So any ideas? Could the problem be in the winnt.h it is using or ?
More info: Win 7 x64 on Intel Core 2 Duo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
的定义
您需要添加http://andre-selmanagic.com/blog/2010/08/02/compiling-a-npapi-plugin-from-the-mozilla-source-code/
You need to add a define for
http://andre-selmanagic.com/blog/2010/08/02/compiling-a-npapi-plugin-from-the-mozilla-source-code/