【发布时间】:2014-11-29 14:05:14
【问题描述】:
我已经在网上搜索过解决方案,但没有任何帮助。 我想用 C++ 编写一个简单的聊天,一切都很好,但我得到了这个错误:
错误 C1189:#error:使用 /MD[d](CRT dll 版本)构建 MFC 应用程序需要 MFC 共享 dll 版本。请#define _AFXDLL 或不要使用/MD[d]
我已经定义了
#define _AFXDLL
但错误仍然发生。任何帮助表示赞赏!
【问题讨论】:
我已经在网上搜索过解决方案,但没有任何帮助。 我想用 C++ 编写一个简单的聊天,一切都很好,但我得到了这个错误:
错误 C1189:#error:使用 /MD[d](CRT dll 版本)构建 MFC 应用程序需要 MFC 共享 dll 版本。请#define _AFXDLL 或不要使用/MD[d]
我已经定义了
#define _AFXDLL
但错误仍然发生。任何帮助表示赞赏!
【问题讨论】:
有两个设置必须相互一致:
(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)(在发布和调试版本中对应)。如果 (1) 是 Use MFC in Shared DLL,那么 (2) 必须是 Multi-threaded DLL (/MD) 或 Multi-threaded Debug DLL (/MDd)。
当两者不同意时,你会得到你所显示的错误。
【讨论】: