今天编译一个工程。
发现如下错误。
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C2146: syntax error : missing ';' before identifier 'Buffer'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>graphics.cpp
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C2146: syntax error : missing ';' before identifier 'Buffer'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>ini.cpp
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C2146: syntax error : missing ';' before identifier 'Buffer'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>input.cpp
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C2146: syntax error : missing ';' before identifier 'Buffer'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>power.cpp
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(236) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C2146: syntax error : missing ';' before identifier 'Buffer'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7818) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Generating Code...
1>Build log was saved at "file://e:\codes\fangyukuan\cpp\game\hge181\src\core\Debug\BuildLog.htm"
1>hge - 25 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
网上查了一下,说是 "winnt.h" 和 "basetsd.h" 用的版本不一样。
还是一头雾水,这个时候 /showIncludes 命令派上用场了。
在工程属性->C/C++->command line 的 additional Options 加上 /showIncludes
把include的路径显示出来。
编译如下:
1>Note: including file: e:\codes\fangyukuan\cpp\game\hge181\src\core\hge_impl.h
1>Note: including file: e:\codes\fangyukuan\cpp\game\hge181\src\core\..\..\include\hge.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\windows.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\sdkddkver.h
1>Note: including file: D:\Program Files\Microsoft Visual Studio 9.0\VC\include\excpt.h
1>Note: including file: D:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h
1>Note: including file: D:\Program Files\Microsoft Visual Studio 9.0\VC\include\sal.h
1>Note: including file: d:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h
1>Note: including file: D:\Program Files\Microsoft Visual Studio 9.0\VC\include\vadefs.h
1>Note: including file: D:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdarg.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\windef.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h
1>Note: including file: D:\Program Files\Microsoft Visual Studio 9.0\VC\include\ctype.h
1>Note: including file: D:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings_adt.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings_strict.h
1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings_undef.h
1>Note: including file: e:\codes\fangyukuan\cpp\3rdparty\dx81sdk\include\basetsd.h
看上面红色部分,果然不一样。把e:\codes\fangyukuan\cpp\3rdparty\dx81sdk\include\basetsd.h删除再编译。这时编译通过了。这时可以把 /showIncludes去掉了。要不输出太多东西,看起复杂啊。
本文地址:http://www.cnblogs.com/fangyukuan/archive/2011/08/18/2144625.html