C++ #error 请使用 /MD 开关进行 _AFXDLL 构建
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4229120/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
#error Please use the /MD switch for _AFXDLL builds
提问by Alex.Yang
I encountered an error in Visual Studio, Please use the /MD switch for _AFXDLL builds
so if I undefine the _AFXDLL
, will my program go wrong?
我在 Visual Studio 中遇到错误,Please use the /MD switch for _AFXDLL builds
所以如果我取消定义_AFXDLL
,我的程序会出错吗?
回答by banuj
Settings for CRT linking and MFC linking must be coherent. So, actually, there are two possible answers at this question:
CRT 链接和 MFC 链接的设置必须一致。所以,实际上,这个问题有两个可能的答案:
Use /MT (Properties -> C/C++ -> Code Generation) and static MFC (Properties -> General -> Use of MFC)
Use /MD (Properties -> C/C++ -> Code Generation) and shared MFC (Properties -> General -> Use of MFC)
使用 /MT(属性 -> C/C++ -> 代码生成)和静态 MFC(属性 -> 通用 -> MFC 的使用)
使用 /MD(属性 -> C/C++ -> 代码生成)和共享 MFC(属性 -> 通用 -> MFC 的使用)
回答by Ben
Yes it will. What you should do is is go to your Visual Studio project properties. In Configuration Properties -> C/C++ -> Code Generation make sure you are using the Multi-threaded Dll for your Runtime Library.
是的,它会。您应该做的是转到您的 Visual Studio 项目属性。在配置属性 -> C/C++ -> 代码生成中,确保为运行时库使用多线程 Dll。
That will solve your problems.
那将解决您的问题。