【发布时间】:2014-10-09 04:09:43
【问题描述】:
我有一个简单的控制台应用程序,它是另一个解决方案的一部分。我决定在新的解决方案中单独使用这个应用程序。打开此应用程序并保存在新创建的解决方案中后,出现以下错误:
Error 9 error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error 4 error C2065: 'PCONTEXT' : undeclared identifier c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12983
Error 10 error C2143: syntax error : missing ';' before '__stdcall' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13372
Error 5 error C2146: syntax error : missing ')' before identifier 'ContextRecord' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error 1 error C2146: syntax error : missing ';' before identifier 'ContextRecord' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
Error 7 error C2182: 'RtlCaptureContext' : illegal use of type 'void' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error 8 error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error 13 error C3861: '__readfsdword': identifier not found c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 14982
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13372
Error 12 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13376
14 IntelliSense: identifier "PCONTEXT" is undefined c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
15 IntelliSense: identifier "PCONTEXT" is undefined c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12983
16 IntelliSense: identifier "PCONTEXT" is undefined c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13371
Warning 6 warning C4229: anachronism used : modifiers on data are ignored c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
对我来说,创建新的控制台应用程序比在那种情况下找出问题要容易得多,但为了获得更多经验,我决定找出问题所在。我比较了这两个应用程序的C/C++ 和Linker 设置(新创建的编译应用程序和一个有错误的应用程序),发现它们之间没有区别。哪里可能出现问题,减缓这些问题的方法是什么?
【问题讨论】:
-
使用
而不是 之前还#define WIN32_LEAN_AND_MEAN在包含 -
我没有使用
,也许有些 vs include 正在使用它。以及为什么新创建的项目具有相同的代码并包含构建良好。 -
失败项目的附加包含中有什么?您是否尝试过在打开 C++/Advanced/ShowIncludes 的情况下编译失败的项目?尝试在工作和非工作项目上。他们应该都在寻找相同的路径,但他们可能不是。
标签: c++ visual-studio-2010 visual-c++