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 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(转)
原文转自 https://www.cnblogs.com/zwh0214/p/6048360.html 在VS 2013中编译程序时出现错误: 错误提示1: error C1189: #error : ...
- 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 ...
随机推荐
- django 创建一个通用视图
创建一个通用视图 抽取出我们代码中共性的东西是一个很好的编程习惯. 比如,像以下的两个Python函数: def say_hello(person_name): print 'Hello, ...
- 增加窗体边框3D效果
/// <summary> /// 增加窗体边框3D效果 /// </summary> /// <param name="e"></par ...
- Lazy<T>
Lazy<T> 对象的创建方式,始终代表了软件工业的生产力方向,代表了先进软件技术发展的方向,也代表了广大程序开发者的集体智慧.以new的方式创建,通过工厂方法,利用IoC容器,都以不同的 ...
- Java笔记:与系统交互、系统相关的类,Object类
1.程序与用户交互 (1)运行一个Java程序的时候要给它提供一个main方法入口,这边分析一下这个main方法的签名public static void main(String[] args);pu ...
- jQuery+JSON+jPlayer实现QQ空间音乐查询
演示地址: http://bejson.com/demos/qqmusic/ 代码下载:http://www.jqdemo.com/932.html 查询QQ音乐是很早前就出来的一个接口. 这里使用j ...
- mybatis逆向工程生成代码
1 什么是逆向工程 mybaits需要程序员自己编写sql语句,mybatis官方提供逆向工程 可以针对单表自动生成mybatis执行所需要的代码(mapper.java,mapper.xml.po. ...
- Ubuntu snappy is lame
ubuntu has just announced that snappy will replace 'apt' as the next generation of package manager f ...
- linux nVidia driver 304 319 . installation by hand
It's so painful to install nVidia driver by hand on linux. If you remove it or you want to upgrade b ...
- 如何使用开源库,吐在VS2013发布之前,顺便介绍下V2013的新特性"Bootstrap"
如何使用开源库,吐在VS2013发布之前,顺便介绍下VS2013的新特性"Bootstrap" 刚看到Visual Studio 2013 Preview - ASP.NET, M ...
- jvm工具
jvm工具 知识,经验是基础,数据是依据,工具是运营知识处理数据的手段 数据:运行日志.异常堆栈.GC日志.线程快照.堆转存储快照 JPS:虚拟机进程状况工具 jvm process status t ...