What is the meaning of Runtime Library /MTd /MT and so on ?
Reading http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=vs.71).aspx, didn’t convince me.
I have to use a third-party project, that has all its “Release” as “/MD” and all its “Debug” as “/MDd”. All my projects (that other people use, so I can’t change) have “/MT” and “/MTd”.
I must add libraries from that third-party project, as input, into my project. To avoid linker errors, I have changed the settings in that project to match my project.
I did that, without understanding the implications.
My project builds, seems to work (have not used a lot of features yet), but the executables from the original project will not build anymore, there are errors like
error C1189: Please use the /MD switch for _AFXDLL builds c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxver_.h
So… I don’t know how to make everything work right, or what are the implications of my change.
Can I somehow combine /MD and /MT libraries ? What would I have to do to make both projects work ?
The
/MDflag implicitly defines the same information as/MT– plus specifies that you’re using the DLL version of the runtime library.The
/MTand/MDflags basically both say to use the multithreaded versions of the runtime library – the difference is that/MDsays to use the DLL based version, while/MTstatically links in the libraries.All of the flags with an extra
dare the debug versions – so/MDdis saying to use the debug version of the DLL-based multithreaded runtime libraries.There aren’t a lot of details in your question about what’s not causing the failing projects to not work. If you switch everything to use
/MD, you’ll need to include the runtime DLLs along with your project, which may be why they are now failing. (Previously, with/MT, they would have been statically linked to your project.)On a side note – the documentation for the flags in the VS 2010 version is quite a bit simpler to understand. The language was simplified dramatically in later documentation releases, even though the flag meanings haven’t changed. It might ease your understanding to look at the 2010 notes instead of the VS 2003 documentation you linked.