致命错误:“无目标体系结构”在Visual Studio中

编程入门 行业动态 更新时间:2024-10-10 04:28:10
本文介绍了致命错误:“无目标体系结构”在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中

本文发布于:2023-11-12 01:51:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580175.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:体系结构   错误   目标   Studio   Visual

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!