c++ – 致命错误:Visual Studio中的“无目标体系结构”
问题:
当我尝试在Win32或x64模式下使用Visual Studio 2010编译我的c ++项目时,我收到以下错误:
>C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\winnt.h(135): fatal error C1189: #error : "No Target Architecture"
我的预处理器定义说WIN32; _DEBUG; _CONSOLE;%(PreprocessorDefinitions)
导致此错误的原因是什么?如何解决?
// winnt.h: lines 127-136, MSVS says this is an inactive preprocessor block
#if defined(_WIN64)
#if defined(_AMD64_)
#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( DWORD )
#elif defined(_IA64_)
#define PROBE_ALIGNMENT( _s ) (TYPE_ALIGNMENT( _s ) > TYPE_ALIGNMENT( DWORD ) ? \
TYPE_ALIGNMENT( _s ) : TYPE_ALIGNMENT( DWORD ))
#else
#error "No Target Architecture"
#endif
更新:我创建了一个新的msvs项目并将我的代码复制到它。 我不再有error : "No Target Architecture"
,但现在我有一堆涉及winnt.h和winbase.h的编译错误,并且没有涉及我的任何文件的编译错误。 这些文件是否可能已损坏? 我需要重新安装MSVS 2010吗?
更新2:所以我缩小了我的问题,发现它是#include <WinDef.h>
导致我的所有编译错误与winnt.h但我仍然不知道如何解决它。
When I try to compile my c++ project using Visual Studio 2010 in either Win32 or x64 mode I get the following error:My preprocessor definitions say WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)What is causing this error and how do I fix it?Update: I created a new msvs project and copied my code to it.I no longer have error : "No Target Architecture"
, but now I have a bunch of compile errors involving winnt.h and winbase.h and no compile errors involving any of my files.Is it possible these files are corrupted?Do I need to reinstall MSVS 2010?Update 2: So I narrowed down my problem and found that it is #include <WinDef.h>
that is causing all of my compile errors with winnt.h but I still don’t know how to fix it.