错误请在#define _AFXDLL或即使在项目属性中进行更改后也不使用/ MD [d] [英] error Please #define _AFXDLL or do not use /MD[d] occurs even after making changes in Project Properties

查看:1785
本文介绍了错误请在#define _AFXDLL或即使在项目属性中进行更改后也不使用/ MD [d]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio 2011中使用Win32项目。当我包含afx.h或afxwin.h时,它会生成MFC错误。
要解决这个问题,我在项目属性选项卡中进行了以下更改:
1)使用MFC:在共享DLL中使用MFC
2)C ++ - >代码生成 - >运行时图书馆 - >多线程调试DLL(/ MDd)



当我构建解决方案时,仍然会出现以下错误:



1> C:\程序文件(x86)\Microsoft Visual Studio 11.0\vc\atlmfc\include\afx.h(24):致命错误C1189:#错误:使用/ MD [d](CRT dll版本)构建MFC应用程序需要MFC共享dll版本。请#define _AFXDLL或不使用/ MD [d]



我的问题是为什么Win32项目生成MFC错误,我应该如何删除这个错误。请指导我。

解决方案

在Visual Studio 2011上,这适用于我:



项目 - > 项目属性 - >配置属性 - > C / C ++ - >高级 - >显示包括: 是(/ showIncludes)



项目 - > 项目属性 - >配置属性 - >一般 - >项目默认值 - >使用MFC: 在共享DLL中使用MFC


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.0\vc\atlmfc\include\afx.h(24): fatal 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]

My question is why Win32 project is generating MFC error and how should I remove this error.Kindly guide me.

解决方案

On Visual Studio 2011, this worked for me:

Project -> "project" Properties -> Configuration Properties -> C/C++ -> Advanced -> Show Includes:YES(/showIncludes)

Project -> "project" Properties -> Configuration Properties -> General -> Project Defaults -> Use of MFC :Use MFC in a shared DLL

这篇关于错误请在#define _AFXDLL或即使在项目属性中进行更改后也不使用/ MD [d]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆