Error C1189: #error: Please use the /MD switch for _AFXDLL builds(转)
原文转自 https://www.cnblogs.com/zwh0214/p/6048360.html
在VS 2013中编译程序时出现错误:
错误提示1:
error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
原因:
常规里面是:在静态库中使用MFC,或使用标准Windows库,此时该处可能无论是什么都会报错
运行库中多线程调试是:MDd(多线程调试DLL)
解决方法:
将MDd改成MTd,如果改正后报错误2,按下面方法更改。
错误提示2:
error C1189: #error: Please use the /MD switch for _AFXDLL builds
原因:
常规里面是:在共享DLL中使用MFC,
运行库中多线程调试是:MTd(多线程调试)
解决方法:
将常规改成:在静态库中使用MFC,或使用标准Windows库
常规和运行库 如下图:
常规: 右击项目->属性->配置属性->常规,然后在右边的“项目默认值”中的“MFC的使用”选项中选择“在静态库中使用MFC”,
多线程调试: 右击项目-->属性->配置属性->c/c++->代码生成->运行时库->多线程调试(/MTd)


相关注释:
MFC的使用,有三种设置:
1.使用标准Windows库
2.在静态库中使用MFC:是将DLL中的相关代码写进EXE文件中,文件较大,但是可以在没有相关DLL的机器上运行;
3.在共享DLL中使用MFC:指的是打包时一些MFC的DLL的内容没有被包含在EXE文件中,所以EXE文件较小,但是运行时要求系统中要有相关的DLL文件;
多线程调试
/MD:在dll中使用多线程,创建动态链接库的release版本,需要选择。
/MT: 在exe里使用多线程,创建exe的release版本,需要选择。
/MTd:同/MT一样,不过是在Debug版本中使用。
/MDL:同/MD一样,不过是在Debug版本中使用。
如果是Debug的“在静态库中使用MFC”,不要使用MDd,改用MTd,然后编译即可通过。
如果是Debug的“在共享DLL中使用MFC”,注意不要使用MTd,改用MDd;
如果是Release版本“在静态库中使用MFC”,不要使用MD,使用MT;
如果是Release版本的“在共享DLL中使用MFC”,不要使用MT,使用MD。
Error C1189: #error: Please use the /MD switch for _AFXDLL builds(转)的更多相关文章
- Error C1189: #error: Please use the /MD switch for _AFXDLL builds
在VS 2013中编译程序时出现错误: 错误提示1: error C1189: #error : Building MFC application with /MD[d] (CRT dll versi ...
- VS错误:#error 指令: Please use the /MD switch for _AFXDLL builds
我在做MFC时遇到过这个问题,解决方法如下: 修改设置:工程(Project)-> 属性(Properties)-> 配置属性(Configuration Properties)-> ...
- 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 ...
- 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 ...
- 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 ...
- 从“空项目”创建MFC项目遇到的问题error C1189,error MSB8031
在VS2013中创建了一个空项目,创建了MyApp.h, MyApp.cpp(MyApp.h使用了<afxwin.h>) build的时候报错: fatal error C1189: #e ...
- 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 ...
- VS2003转VS2010 fatal error C1189: #error
我自己的mfc的demo要转换编译环境出现以下编译错误: VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT ...
- 【转】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 ...
随机推荐
- emplace_back
c++11 的 list deque 和 vector 增加了emplace_back函数,相对于push_back函数,它减少了一次类的构造,因此效率更高,推荐使用. #include <li ...
- 36-应用Jwtbearer Authentication
新建.net core webapi项目 E:\coding\netcore>dotnet new webapi --name JwtAuthSample 创建需要用到的实体对象类 namesp ...
- 笔记-python lib-pymongo
笔记-python lib-pymongo 1. 开始 pymongo是python版的连接库,最新版为3.7.2. 文档地址:https://pypi.org/project/pymong ...
- python sys模块和序列化模块
sys模块是与python解释器交互的一个接口: sys.argv 命令行参数List,第一个元素是程序本身路径 sys.exit(n) 退出程序,正常退出时exit(0),错误退出sys.exit( ...
- 5 Django-1的路由层(URLconf)
URL配置(URLconf)就像Django 所支撑网站的目录.它的本质是URL与要为该URL调用的视图函数之间的映射表:你就是以这种方式告诉Django,对于客户端发来的某个URL调用哪一段逻辑代码 ...
- 十四、pymysql模块
一.安装的两种方法 第一种 #安装 pip3 install pymysql 第二种 二.链接,执行sql,关闭(游标) import pymysql user= input('用户名:>> ...
- java.lang.RuntimeException: Handler (com.***.behavior.BEvent$1) {421bca80} sending message to a Hand
java.lang.RuntimeException: Handler (com.***.behavior.BEvent$1) {421bca80} sending message to a Hand ...
- python开发记录第一篇
1. 安装pyCharm,下载地址https://www.jetbrains.com/pycharm/ 2. 注册license,修改windwos系统hosts,文件路径为:C:\Windows\S ...
- USACO Section1.2 Milking Cows 解题报告
milk2解题报告 —— icedream61 博客园(转载请注明出处)---------------------------------------------------------------- ...
- 我给女朋友讲编程CSS系列(4) CSS盒子模型
什么是CSS盒子模型?如何学习CSS的盒子模型? 这篇文章,以 [分享 + 结论] 的方式来写. 1, 看w3school的[CSS 框模型概述] 网址为: http://www.w3school ...