Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#error Please use the /MD switch for _AFXDLL builds

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?

like image 633
Alex.Yang Avatar asked Nov 19 '10 20:11

Alex.Yang


2 Answers

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

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

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

like image 94
banuj Avatar answered Oct 20 '22 15:10

banuj


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.

That will solve your problems.

like image 10
Ben Avatar answered Oct 20 '22 17:10

Ben