error Please #define _AFXDLL or do not use /MD[d] occurs even after making changes in Project Properties(错误请#define _AFXDLL 或不使用/MD[d] 即使在项目属性中进行更改后也会发生)
问题描述
我正在 Visual Studio 2011 中处理 Win32 项目.当我包含 afx.h 或 afxwin.h 时,它会生成 MFC 错误.为了解决这个问题,我在项目属性"选项卡中进行了以下更改:1)MFC的使用:在共享DLL中使用MFC2) C++ -> 代码生成 -> 运行库 -> 多线程调试 DLL(/MDd)
I am working on Win32 project in Visual Studio 2011. It is generating MFC error when I includes afx.h or afxwin.h. To resolve this, I have made the following changes in the Project Properties tab : 1) Use of MFC : Use MFC in a shared DLL 2) C++ -> Code Generation -> Runtime Library -> Multi-threaded Debug DLL(/MDd)
当我构建解决方案时,它仍然给我以下错误:
Still it gives me following error when I build the solution :
1>C:Program Files (x86)Microsoft Visual Studio 11.0vcatlmfcincludeafx.h(24): 致命错误 C1189: #error : Building MFC application with/MD[d](CRT dll 版本)需要 MFC 共享 dll 版本.请#define _AFXDLL 或不要使用/MD[d]
我的问题是为什么 Win32 项目会产生 MFC 错误以及我应该如何消除这个错误.请指导我.
My question is why Win32 project is generating MFC error and how should I remove this error.Kindly guide me.
推荐答案
在 Visual Studio 2011 上,这对我有用:
On Visual Studio 2011, this worked for me:
项目 ->项目"属性 ->配置属性 ->一般 ->项目默认值 ->MFC的使用:
在共享DLL中使用MFC
(在Visual Studio 2019中,后面的设置可以在Properties -> Configuration Properties -> Advanced -> Use of MFC
"
(In Visual Studio 2019, the latter setting can be found in "Properties -> Configuration Properties -> Advanced -> Use of MFC
"
这篇关于错误请#define _AFXDLL 或不使用/MD[d] 即使在项目属性中进行更改后也会发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:错误请#define _AFXDLL 或不使用/MD[d] 即使在项目属性中进行更改后也会发生


基础教程推荐
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01