【发布时间】: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 <tchar.h>(无论如何你不应该使用TCHAR,它已经完全过时了18年)。还要确保其他包含文件(例如targetver.h)没有任何#include <windows.h>行。 -
我认为问题出在
profileapi.h,因为它是 Windows 标头,这意味着它必须包含在之后#include <windows.h>。
标签: c++ visual-studio