错误请#define _AFXDLL 或不使用/MD[d] 即使在项目属性中进行更改后也会发生

2023-07-02C/C++开发问题
9

本文介绍了错误请#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] 即使在项目属性中进行更改后也会发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么 C++ 不能从赋值推导出模板类型?
Why can#39;t C++ deduce template type from assignment?(为什么 C++ 不能从赋值推导出模板类型?)...
2024-08-14 C/C++开发问题
8

有状态函子 &STL:未定义的行为
Stateful functors amp; STL : Undefined behaviour(有状态函子 amp;STL:未定义的行为)...
2024-08-14 C/C++开发问题
9

你什么时候在 C++ 中使用函数对象?
When do you use function objects in C++?(你什么时候在 C++ 中使用函数对象?)...
2024-08-14 C/C++开发问题
8

插入 STL 映射是否会使其他现有迭代器无效?
Does insertion to STL map invalidate other existing iterator?(插入 STL 映射是否会使其他现有迭代器无效?)...
2024-08-14 C/C++开发问题
8