致命错误:“无目标体系结构”在Visual Studio中 [英] Fatal error: "No Target Architecture" in Visual Studio
问题描述
当我尝试使用Visual Studio 2010在Win32或x64模式编译我的c + +项目我得到以下错误:
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 SDKs \Windows \v7.0A\include\winnt.h(135):致命错误C1189:#error:无目标体系结构
我的预处理器定义是WIN32; _DEBUG; _CONSOLE;%(PreprocessorDefinitions)
My preprocessor definitions say 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项目,代码。我不再有错误:无目标体系结构
,但现在我有一堆编译错误涉及winnt.h和winbase.h和没有编译错误涉及任何我的文件。这些文件可能已损坏吗?我需要重新安装MSVS 2010吗?
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?
更新2:所以我缩小了我的问题,发现它是 #include< WinDef.h> ;
这是导致我所有的编译错误与winnt.h但我仍然不知道如何解决它。
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.
推荐答案
使用 #include< windows.h>
而不是 #include< windef.h>
。
从 窗口。 h
维基百科页面:
From the windows.h
wikipedia page:
有许多子标题文件会自动包含在
windows.h
。这些文件中的许多文件本身不能简单地包含(它们不是自包含的),因为依赖性。
There are a number of child header files that are automatically included with
windows.h
. Many of these files cannot simply be included by themselves (they are not self-contained), because of dependencies.
windef.h
是 windows.h
自动包含的文件之一。
windef.h
is one of the files automatically included with windows.h
.
这篇关于致命错误:“无目标体系结构”在Visual Studio中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!