【问题标题】:Visual Studio Professional 2013, Update 5, "No Target Architecture"Visual Studio Professional 2013,更新 5,“无目标体系结构”
【发布时间】:2020-04-03 09:23:35
【问题描述】:

我在 Visual Studio 中有一个 CPP 项目,当我尝试构建解决方案时收到以下消息:

    1>c:\program files (x86)\windows kits\8.1\include\um\winnt.h(147): fatal error C1189: #error :  "No Target Architecture"

stdafx.h 的内容:

    #pragma once

    #include "targetver.h"

    #include <stdio.h>
    #include <tchar.h>
    #include <ctime>
    #include <time.h>
    #include <iostream>
    #include <profileapi.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <Windows.h>

缺少什么?

【问题讨论】:

  • 我建议你可以参考链接:stackoverflow.com/questions/4845198/….
  • @Jeaninez-MSFT,抱歉,我在发布我的问题之前看到并阅读了它,它没有帮助。
  • 我怀疑你需要删除#include &lt;tchar.h&gt;(无论如何你不应该使用TCHAR,它已经完全过时了18年)。还要确保其他包含文件(例如targetver.h)没有任何#include &lt;windows.h&gt; 行。
  • 我认为问题出在profileapi.h,因为它是 Windows 标头,这意味着它必须包含在之后 #include &lt;windows.h&gt;

标签: c++ visual-studio


【解决方案1】:

最后我发现删除了标题:

    profileapi.h
    sys/types.h

解决了这个问题,项目现在可以在没有警告或错误的情况下构建。

谢谢戴,更好的解决方案:

    #include "targetver.h"
    #include <Windows.h>

    #include <stdio.h>
    #include <tchar.h>
    #include <iostream>
    #include <chrono>
    #include <ctime>
    #include <time.h>
    #include <fstream>
    #include <profileapi.h>
    #include <sys/stat.h>
    #include <sys/types.h>

【讨论】:

  • 您仍然可以在您的stdafx.h 文件中包含这些标题,但您只需确保它们位于下面 #include &lt;windows.h&gt; 行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-06-18
  • 1970-01-01
  • 2016-07-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多