mfc静态链接库报错

来源:互联网 发布:天宝无人机info软件 编辑:程序博客网 时间:2024/06/05 16:42

问题
fatal error C1189: #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL ordo not use /MD[d]

我的项目是标准Windows的Dll,导入了自己的几个头文件和静态库,编译时报以上错误,修改运行时库为多线程 DLL (/MT),
报以下错误:
fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.

两种方案

一、使用/MD选项,并在你的工程属性里添加 _AFXDLL 的定义(右键工程名->properties->C/C++->Preprocessor这一页下有Preprocessor Definitions 在这里添加)

二、使用/MT选项,删除你代码里#include <windows.h> 


原文链接

0 0