Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between /MD and /MDd (Use Run-Time library)?

Tags:

c++

When I added the following line to my code:

std::string sFrameTag

I got the following linker error:

Error 34 error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_string@DU? $char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in VFPAnalyzerApi.lib(VFPEvaluation.obj) msvcprtd.lib

I took a look at the project properties, under C/C++ -> code generation -> runtime Library and changed it from /MDd to /MD and somehow the error disappeared.. However, I don't really understand what's the difference and why it worked. Can someone please explain what exactly have I changed and why it made a difference?

Thanks!!!

like image 294
GilLevi Avatar asked Mar 28 '13 09:03

GilLevi


1 Answers

MSDN has good docs on this.

In short, /MDd links the necessary parts of a debug build of the C & C++ standard libraries into your DLL. /MD is similar but uses a NDEBUG version of the standard libraries. If you try to link code that combines debug and release standard libraries, you'll get symbol clashes as both libraries will provide the same set of functions.

like image 130
simonc Avatar answered Oct 11 '22 00:10

simonc