Visual studio - prevent linking of static library -
i creating static library in visual studio 2010. library statically linked of applications produce .exe. thing want .exe statically linked against c adn c++ library (don't want dependency on msvcp100.dll , msvcr100.dll). ever can't working.
if link static library static c , c++ libs can't compile .exe - linker complains "already defined symbols".
if link static library c , c++ dll .exe ends having dependency on msvcp100.dll , msvcr100.dll.
how tell vs link static library static c , c++ libs when it's being linked in .exe?
edit
here fre linker errors when both static lib , .exe user /mt (i.e. static linking of runtime library):
1>msvcrt.lib(ti_inst.obj) : error lnk2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@aae@abv0@@z) defined in libcmt.lib(typinfo.obj) 1>msvcprt.lib(msvcp100.dll) : error lnk2005: "public: class std::locale::facet * __thiscall std::locale::facet::_decref(void)" (?_decref@facet@locale@std@@qaepav123@xz) defined in re2_release.lib(regexp.obj) 1>msvcprt.lib(msvcp100.dll) : error lnk2005: "protected: virtual class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setbuf(char *,__int64)" (?setbuf@?$basic_streambuf@du?$char_traits@d@std@@@std@@maepav12@pad_j@z) defined in re2_release.lib(regexp.obj) 1>msvcrt.lib(msvcr100.dll) : error lnk2005: _strtoul defined in libcmt.lib(strtol.obj) 1>libcmt.lib(crt0init.obj) : warning lnk4098: defaultlib 'msvcrt.lib' conflicts use of other libs; use /nodefaultlib:library
if set /nodefaultlib:libcmt errors mscvrt.lib disappear, msvcprt.lib errors remain.
i had problem, , libriks solution solved it. quote him here skips reading comments:
some module not using static linking of runtime library, because linker errors >show "msvcrt.lib" import library dll version. more >through project settings, , other libraries link to, making sure >using /mt.
Comments
Post a Comment