By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

linking errors in 2005 only with /MT option, nothing else

P: n/a
I am in the process of trying to migrate a couple of build solutions to
Visual Studio Express 2005 from VS 2003 Professional and I am running
into a weird C/C++ runtime library linking issue when using the /MT
compilation option. Our debug solution's /MTd flag works fine and
using /MD also seems to work ok. For some reason I can't fathom, when
I use /MT, linking the static excutable completely dies (problems
resolving symbols in the STL, etc.)

I have tried using the /NODEFAULTLIB: option to tweak what I link
against using this webpage which hasn't helped:
http://msdn.microsoft.com/library/de...ary/en-us/vcco...

I also tried explicitly forcing the linking of only the libraries
libcmt.lib and libcpmt.lib by disallowing implicit linking against
everything else and specifying them manually.

Here is the output from the build:

------ Rebuild All started: Project: WTF, Configuration: Release Win32
------
Deleting intermediate and output files for project 'WTF', configuration
'Release|Win32'
Compiling...
stdafx.cpp
Compiling...
WTF.cpp
Linking...
libcpmt.lib(locale0.obj) : error LNK2005: "public: static unsigned int
const std::ctype<char>::table_size" (?table_size@?$ctype@D@std@@2IB)
already defined in WTF.obj
libcpmt.lib(ios.obj) : error LNK2005: "public: void __thiscall
std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z)
already defined in WTF.obj
WTF.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3
referenced in function __ehhandler$_wmain
Sys.lib(SysHost.obj) : error LNK2001: unresolved external symbol
___CxxFrameHandler3
WTF.obj : error LNK2001: unresolved external symbol "public: __thiscall
std::exception::exception(class std::exception const &)"
(??0exception@std@@QAE@ABV01@@Z)
Sys.lib(SysHost.obj) : error LNK2001: unresolved external symbol
"public: __thiscall std::exception::exception(class std::exception
const &)" (??0exception@std@@QAE@ABV01@@Z)
WTF.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ)
referenced in function
__unwindfunclet$??0runtime_error@std@@QAE@ABV01@@Z $0
Sys.lib(SysHost.obj) : error LNK2001: unresolved external symbol
"public: virtual __thiscall std::exception::~exception(void)"
(??1exception@std@@UAE@XZ)
WTF.obj : error LNK2019: unresolved external symbol "public: __thiscall
std::exception::exception(void)" (??0exception@std@@QAE@XZ) referenced
in function "public: __thiscall std::runtime_error::runtime_error(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??0runtime_error@std@@QAE@ABV?$basic_string@DU?$c har_traits@D@std@@V?$allocator@D@2@@1@@Z)
....
Sys.lib(SysHost.obj) : error LNK2001: unresolved external symbol
_memcpy_s
WTF.obj : error LNK2019: unresolved external symbol _memmove_s
referenced in function "public: static char * __cdecl
std::char_traits<char>::_Move_s(char *,unsigned int,char const
*,unsigned int)" (?_Move_s@?$char_traits@D@std@@SAPADPADIPBDI@Z)
Sys.lib(SysHost.obj) : error LNK2001: unresolved external symbol
_memmove_s
Z:\proj\Release\WTF.exe : fatal error LNK1120: 11 unresolved externals

I have trimmed down my compile flags for the "Release" configuration as
much as sensible to match the "Debug" configuration which does link.
The only thing that seems to matter is the choice of /MT vs. /MTd.

The only two projects involved are "Sys" and "WTF". Sys is a static
library being compiled with /MT and WTF is a Console app linking to
Sys.lib and also being compiled with /MT. I have obviously done full
rebuilds of both projects many times.

Anybody have any ideas what might cause this?

Jun 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.