Grigory Sokolov
Grigory Sokolov

Reputation: 1

Why /MD is compiler's option? not linker's?

Possible Duplicate:
Why is runtime library a compiler option rather than a linker option?

I do not understand clearly why i have to choose type of RTL at the compiling stage?

For example i have created one static library A.lib with option /MD. Then i've created second static library B.lib with option /MT.

When i try to link A.lib and B.lib to my C.exe I will get linker error.

But at the compiling stage (creation A.lib and B.lib) there is no any reasons to resolve symbols from c or c++ runtime.

Upvotes: 0

Views: 419

Answers (1)

Employed Russian
Employed Russian

Reputation: 213955

When you build with /MD, the compiler uses a different set of predefined macros, then when you build with /MT. See documentation and pay attention to _MT, _DLL, etc. macros.

at the compiling stage (creation A.lib and B.lib) there is no any reasons to resolve symbols from c or c++ runtime.

That is true, but if you include any system headers, your preprocessed source is actually different depending on which of /MD, /MT, etc. flags you've used, and that matters very much at compile stage.

Upvotes: 1

Related Questions