在编译程序的时候发现报这个错误,在网上看到很多文章,说设置include路径,lib目录等等,都没有解决。最后调整了以下include文件的顺序,问题解决了。例如





从头文件a.h中截取的一段





typedef struct

{

    DWORD Data1;

    WORD Data2;

    WORD Data3;

    BYTE Data4[ 8 ];

} GUID;





 





然后在b.cpp文件里面引用





#include <a.h>





#include <Windows.h>





这样编译会报错





程序报错:error C2146: 语法错误 : 缺少“;”





其原因是在a.h文件中 DWORD未定义,在a.h文件中引用minwindef.h再编译就会报错 fatal error C1189: #error : "No Target Architecture"





#include <minwindef.h>





typedef struct

{

DWORD Data1;

WORD Data2;

WORD Data3;

BYTE Data4[ 8 ];

} GUID;





再引用windows.h





#include <windows.h>





#include <minwindef.h>





typedef struct

{

DWORD Data1;

WORD Data2;

WORD Data3;

BYTE Data4[ 8 ];

} GUID;





然后就可以正常编译了,其实不用这么复杂,直接在b.cpp文件中调整下引用文件的顺序就可以了,如下





#include <Windows.h>





#include <a.h>

fatal error C1189: #error : "No Target Architecture" 解决办法一的更多相关文章

  1. VS2003转VS2010 fatal error C1189: #error

    我自己的mfc的demo要转换编译环境出现以下编译错误: VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT ...

  2. fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

    给对话框添加类, 报错 CalibrateMFCDlg.h(6) : error C2504: “CDialog”: 未定义基类 等多个错误 加上 #include "afxwin.h&qu ...

  3. 【转】fatal error C1189: #error : missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS

    转自:http://blog.csdn.net/friendan/article/details/46576699 fatal error C1189: #error :  missing -D__S ...

  4. fatal error C1189: #error : core.hpp header must be compiled as C++

    两次opencv工程需要设置为C++编译:找了一半天的解决方法. I am building a C application that uses OpenCV. when compiling, I g ...

  5. fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC

    出现如下错误: fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires ...

  6. fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC sha

    调试程序时出现以下问题:d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal e ...

  7. fatal error C1189: #error: "Oops: min() and/or max() are defined as preprocessor macros. Define NOMINMAX macro before including any system headers!"

    1.问题描述 vs2015 使用pg数据库的C++库文件4.0.1版本libpqxx.dll,包含头文件#include "pqxx\pqxx" 出现这个错误: fatal err ...

  8. error C2065: “CString”: 未声明的标识符 ;fatal error C1189: #error : afxstr.h can only be used in MFC proje

    转自VC错误:http://www.vcerror.com/?p=1388 问题描述: error C2065: "CString": 未声明的标识符 fatal error C1 ...

  9. vc/atlmfc/include/afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT

    环境:win7,64位,vs2012 1> c:/program files/microsoft visual studio 8/vc/atlmfc/include/afx.h(24) : fa ...

随机推荐

  1. getstu

    #coding: utf- #title..href... import urllib.request import time url=[ page= j= : url[j]='http://www. ...

  2. HTML-参考手册: HTML 符号实体

    ylbtech-HTML-参考手册: HTML 符号实体 1.返回顶部 1. HTML 符号实体 本字符实体参考手册包括了数学符号.希腊字符.各种箭头记号.科技符号以及形状. 注释: 实体名称对大小写 ...

  3. Windows-WAMP搭建与配置

    使用 WampServer 整合软件包进行 WAMP 环境搭建 WampServer 是一款由法国人开发的 Apache Web 服务器.PHP 解释器以及 MySQL 数据库的整合软件包.免去了开发 ...

  4. 用 Flask 来写个轻博客 (9) — M(V)C_Jinja 语法基础快速概览

    #目录 前文列表 扩展阅读 Jinja 变量名 注释 控制语句 if 语句 循环 过滤器 无参数调用 带参数调用 宏 定义宏 调用宏 结果 兼容 JavaScript 前文列表 用 Flask 来写个 ...

  5. npm ERR! cb() never called! npm ERR! This is an error with npm itself. Pleas

    原因是:需要用管理员的身份才能进行 方法:点开始,找到命令提示符,右键,点以管理员的身份运行命令即可

  6. 10 面向对象(package关键字的概述及作用)

    10.01_面向对象(package关键字的概述及作用) A:为什么要有包 *开发时有很多类,如果放在一个文件夹中不方便管理,而且容易重复 将字节码(.class)进行分类存放 包其实就是文件夹 B: ...

  7. python学习笔记:函数

    一.函数是什么 函数一词来源于数学,但编程中的「函数」概念,与数学中的函数是有很大不同的,编程中的函数在英文中也有很多不同的叫法.在BASIC中叫做subroutine(子过程或子程序),在Pasca ...

  8. Django框架(十四)—— Django分页组件

    目录 Django分页组件 一.分页器 二.分页器的使用 三.案例 1.模板层 2.视图层 Django分页组件 一.分页器 数据量大的话,可以分页获取,查看 例如:图书管理中,如果有成千上万本书,要 ...

  9. 進階gdb之core dump的除錯

    core dump的除錯 Basic Perl等語言處理的可以說是User的資料, C可以說在那邊把資料在記憶體移來移去, 組語可說把資料在暫存器搬來搬去, 越低階的處理表示握有的資源越少 所以C處理 ...

  10. spring security 学习二

    doc:https://docs.spring.io/spring-security/site/docs/ 基于表单的认证(个性化认证流程): 一.自定义登录页面 1.在securityConfigy ...