MSVC 2010 2005 linker error with std :: cout in the static library

I found other examples of people having this problem, but they were out of luck with their solutions. I am trying to use std :: cout in a static library that also uses boost and bind streams. When I do not use and std::cout, it compiles and links perfectly with the main program, but when I make and compile the library, I have no problems, but when I compile and link the main program using the static library, I get a ton of things like:

2> LIBCMT.lib (crt0init.obj): error LNK2005: ___xi_z already defined in MSVCRTD.lib (cinitexe.obj)
2> LIBCMT.lib (crt0init.obj): error LNK2005: ___xc_a already defined in MSVCRTD.lib (cinitexe.obj)
2> LIBCMT.lib (crt0init.obj): error LNK2005: ___xc_z already defined in MSVCRTD.lib (cinitexe.obj)
2> LIBCMT.lib (mlock.obj): error LNK2005: __unlock already defined in MSVCRTD.lib (MSVCR100D.dll)
2> LIBCMT.lib (mlock.obj): error LNK2005: __lock already defined in MSVCRTD.lib (MSVCR100D.dll)
2> LIBCMT.lib (winxfltr.obj): error LNK2005: __XcptFilter already defined in MSVCRTD.lib (MSVCR100D.dll)
2> LIBCMT.lib (crt0.obj): error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib (crtexe.obj)

etc...

I tried to go to my linker settings and stop it from using the conflicting library indicated in the error output, but I can’t get it right. If I tell him to stop using one library, this can solve the problems, but give me some missing external characters, then I will switch the library that she is having problems with, but I still get a few "already defined" ones. Any tips on what I can do to fix this? Should I just create another class called "log" or something else, and just get it from the main .exe (which will use the string library, which may cause problems again, but I haven't tried it yet)? Thanks for any help.

+3
source share
3

→ Project + Properties, C/++, , . .lib .

+9

, , C/++, , . . /MT /MD. , .

Boost . . IIRC,.libs mt md .

+3

LNK2005 , . , , , , , .

, , lib/ boost /MT, MSVC . , (/MD, MSVCR100.DLL, MSVCP100.DLL).

. http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

, , .

I have to add what Ddebugging means in the end. those. MSVCP100D.DLLis a debug version MSVCP100.DLL.

+2
source

Source: https://habr.com/ru/post/1784301/


All Articles