Instead of creating 4 different libraries (one for MT, MTd, MD, MDd ) I want to create a lib that does not determine its dependency on the runtime library (CRT).
I tried passing the "/ c / Zl" parameter to the vc10 compiler, then / NODEFAULTLIB to the lib command. Later, when I use such a lib, I still have errors when I compile my program using a switch other than default / MT. for example / MD here are the first few errors:
msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct st d::char_traits<char> >::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > & (__cdecl*)(class std::basic_ostream<char,struct std::char_tra its<char> > &))" ( ??6?$basic_ostream@DU ?$char_traits@D @ std@ @@ std@ @ QAEAAV01@P6AAAV01 @ AAV01@ @ Z@Z ) already defined in lib.lib(lib.obj) msvcprt.lib(MSVCP100.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::endl(class std::basic_ostream<char,stru ct std::char_traits<char> > &)" ( ?endl@std @@ YAAAV?$basic_ostream@DU ?$char_traits@D @ std@ @@ 1@AAV21 @@Z) already defined in lib.lib(lib.obj)
Is it possible to create a static library (single .lib file), which can later be compiled in the final programs using / MT, / MTd, / MD or / MDd?
c ++ visual-c ++ command-line-arguments compiler-errors static-libraries
Szymon wybranski
source share