When I try to compile my c++ project using Visual Studio 2010 in either Win32 or x64 mode I get the following error:
>C:Program Files (x86)Microsoft SDKsWindowsv7.0Aincludewinnt.h(135): fatal error C1189: #error : "No Target Architecture"
My preprocessor definitions say WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
What is causing this error and how do I fix it?
// 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
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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…