Alex.Yang
Alex.Yang

Reputation: 519

#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?

Upvotes: 32

Views: 45665

Answers (2)

banuj
banuj

Reputation: 3230

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)

Upvotes: 50

Ben
Ben

Reputation: 160

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.

Upvotes: 10

Related Questions