错误 C1189 MFC

Error C1189 MFC(错误 C1189 MFC)

本文介绍了错误 C1189 MFC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上搜索过解决方案,但没有任何帮助.我想用 C++ 编写一个简单的聊天,一切都很好,但我得到了这个错误:

I already searched for solutions online, but nothing helped me. I want to code a simple Chat in C++, everything is fine, but I get this error:

错误 C1189:#error:使用/MD[d](CRT dll 版本)构建 MFC 应用程序需要 MFC 共享 dll 版本.请#define _AFXDLL 或不要使用/MD[d]

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]

我已经定义了

#define _AFXDLL

但错误仍然发生.任何帮助表示赞赏!

but the error is still occures. Any help is apprecicated!

推荐答案

有两个设置必须互相一致:

There are two settings that must agree with each other:

(1) Project > Properties > General > Use of MFC
(2) Project > Properties > C/C++ / Code Generation / Runtime Library

如果 (1) 设置为 Use MFC in static library,那么 (2) 必须是 Multithreaded (/MT)Multithreaded Debug (/MTd) (在 Release 和 Debug 版本中,相应地).如果 (1) 是 Use MFC in Shared DLL,那么 (2) 必须是 Multi-threaded DLL (/MD)Multi-threaded Debug DLL (/MDd).

If (1) is set to Use MFC in static library, then (2) must be Multithreaded (/MT) or Multithreaded Debug (/MTd) (in Release and Debug builds, correspondingly). If (1) is Use MFC in Shared DLL, then (2) must be Multi-threaded DLL (/MD) or Multi-threaded Debug DLL (/MDd).

当两者不同意时,你会得到你所显示的错误.

When the two don't agree, you get the error you've shown.

这篇关于错误 C1189 MFC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:错误 C1189 MFC

基础教程推荐