gpt4 book ai didi

c++ - winnt.h 包含问题

转载 作者:行者123 更新时间:2023-12-05 06:45:10 25 4
gpt4 key购买 nike

我有一个简单的控制台应用程序,它是另一个解决方案的一部分。我决定在新解决方案中单独使用此应用程序。打开此应用程序并保存在新创建的解决方案中后,出现以下错误:

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 设置,发现它们之间没有区别。问题出在哪里?有什么办法可以减缓此类问题?

最佳答案

如果有人像我一样通过 Google 找到这个:对于 CLI/C++ 项目,请确保您包含的所有非托管 .cpp 文件都设置为在不支持 CLR 的情况下编译。请参阅下面的链接以及 Hans Passant 的回答。

这为我解决了这个问题。

C++ CLI Correct way to use #pragma managed / unmanaged

关于c++ - winnt.h 包含问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25326152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com