I'm trying to deploy my executable to another machine so I need non-debug runtime.
Switching to non-debug runtime /MT causes link errors. /Mtd compiles fine. Here's a sampling of the many errors.
1>libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol _calloc_dbg 1>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _calloc_dbg 1>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _calloc_dbg 1>libcpmtd.lib(StlCompareStringA.obj) : error LNK2001: unresolved external symbol _free_dbg 1>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _free_dbg 1>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _free_dbg 1>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol _free_dbg 1>libcpmtd.lib(xwcsxfrm.obj) : error LNK2001: unresolved external symbol _free_dbg
If I explicitly tell linker to link with libcmtd.lib, it compiles even with /MT, but what are the consequences of this?
How do I get my code to compile? (without having to do the trick above?)
Edit: I commented out the statements using cout and it compiled.... why...
You say you explicitly force libcmtd.lib as linker input - that is the debug version of the static CRT, and is exactly the source of the conflict with /MT (a switch declaring linkage with the release static CRT).
Remove libcmtd from the linker input altogether and check if it works.
Remove _DEBUG define from C++ preprocessor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With