#error请使用/ MD开关进行_AFXDLL构建

时间:2022-09-01 13:44:51

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中遇到错误,请使用/ MD开关进行_AFXDLL构建,如果我取消定义_AFXDLL,我的程序会出错吗?

2 个解决方案

#1


28  

Settings for CRT linking and MFC linking must be coherent. So, actually, there are two possible answers at this question:

CRT链接和MFC链接的设置必须一致。实际上,在这个问题上有两个可能的答案:

  1. Use /MT (Properties -> C/C++ -> Code Generation) and static MFC (Properties -> General -> Use of MFC)

    使用/ MT(属性 - > C / C ++ - >代码生成)和静态MFC(属性 - >常规 - >使用MFC)

  2. Use /MD (Properties -> C/C++ -> Code Generation) and shared MFC (Properties -> General -> Use of MFC)

    使用/ MD(属性 - > C / C ++ - >代码生成)和共享MFC(属性 - >常规 - >使用MFC)

#2


6  

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.

这将解决你的问题。

#1


28  

Settings for CRT linking and MFC linking must be coherent. So, actually, there are two possible answers at this question:

CRT链接和MFC链接的设置必须一致。实际上,在这个问题上有两个可能的答案:

  1. Use /MT (Properties -> C/C++ -> Code Generation) and static MFC (Properties -> General -> Use of MFC)

    使用/ MT(属性 - > C / C ++ - >代码生成)和静态MFC(属性 - >常规 - >使用MFC)

  2. Use /MD (Properties -> C/C++ -> Code Generation) and shared MFC (Properties -> General -> Use of MFC)

    使用/ MD(属性 - > C / C ++ - >代码生成)和共享MFC(属性 - >常规 - >使用MFC)

#2


6  

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.

这将解决你的问题。