This article is only for limited audiences. If you use Visual Studio C++ (2008) and have a question about What is the MD and MT, then you might be interested in this.
When I made a Console Application on the Visual C++ 2008 using STL. I start to get the following error.
error LNK2001: unresolved external symbol __imp___CrtDbgReportW
It is related with a Windows runtime library. One thing is Unicode related, so I switched off.
It seems this is related C/C++ Code generation, Multi-threaded Debug Dll (MT option) (/Mdd) or Multi-threaded debug (/MTd). (Note: only one character difference /MDd and /MTd.) In some reason while I develop an application, I got a warning about there is a library conflict, and suggested to ignore one of the runtime libraries. I followed the link's output and ignore the 'MSVCRT' library. But this is the problem. I removed it from the ignore library list.
I set up all the Code Generation to Multi-threaded Debug DLL (/MDd) for debug, and not ignore any runtime library. Then now it works. This was a confusion.
Then, I asked my colleague, T. What is this MD and MT stuffs. He said:
- MT: Multi-threaded static library. This is good for distribution a whole application package, since everything is statically linked and there is no dependency to the environment.
- MD: Multi-threaded Dynamic link library. If you distribute some library instead of a whole application, dynamically linked runtime is better since, some part of the program uses one version of runtime, and the other uses different version,this causes a trouble. For example, 'new'ed some memory at one version of runtime, and 'delete'd by other version of runtime could be a trouble.
So, it depends on the situation and I see now it is better to have both. But these are too similar and I am easy to confuse them.
When I made a Console Application on the Visual C++ 2008 using STL. I start to get the following error.
error LNK2001: unresolved external symbol __imp___CrtDbgReportW
It is related with a Windows runtime library. One thing is Unicode related, so I switched off.
It seems this is related C/C++ Code generation, Multi-threaded Debug Dll (MT option) (/Mdd) or Multi-threaded debug (/MTd). (Note: only one character difference /MDd and /MTd.) In some reason while I develop an application, I got a warning about there is a library conflict, and suggested to ignore one of the runtime libraries. I followed the link's output and ignore the 'MSVCRT' library. But this is the problem. I removed it from the ignore library list.
I set up all the Code Generation to Multi-threaded Debug DLL (/MDd) for debug, and not ignore any runtime library. Then now it works. This was a confusion.
Then, I asked my colleague, T. What is this MD and MT stuffs. He said:
- MT: Multi-threaded static library. This is good for distribution a whole application package, since everything is statically linked and there is no dependency to the environment.
- MD: Multi-threaded Dynamic link library. If you distribute some library instead of a whole application, dynamically linked runtime is better since, some part of the program uses one version of runtime, and the other uses different version,this causes a trouble. For example, 'new'ed some memory at one version of runtime, and 'delete'd by other version of runtime could be a trouble.
So, it depends on the situation and I see now it is better to have both. But these are too similar and I am easy to confuse them.
Comments