LNK2005 terror



  • Hallo Gemeinde,

    (VS2010, 4.8.0)

    ich benutze neuerdings in einer eingebundenen eigenen Bibliothek eine Bibliothek, die auf /MT kompiliert zu sein scheint.

    Ich habe deswegen die Codegenerierung meiner eigenen auf /MT umgestellt. In einer Test-Konsolenumgebung (die mit /MT kompiliert ist) läuft es einwandfrei.

    Ich kann die eingebundene Bibliothekt nicht auf MD kompilieren, da ich sie nicht besitze und so gut wie keine Chance habe, an den Quellcode zu kommen.

    Qt zickt beim kompilieren, und will nicht linken, wenn ich meine QT Applikation auf /MT kompiliert habe.

    Ich habe deswegen nochmal gesamt QT neukompiliert (statisch, mit MT).

    Ich kriege immer noch diesen Rotz:

    1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) ist bereits in libcpmt.lib(xthrow.obj) definiert.
    1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::_Container_base0::_Orphan_all(void)" (?_Orphan_all@_Container_base0@std@@QAEXXZ) ist bereits in WindowManager.obj definiert.
    1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ) ist bereits in libcpmt.lib(uncaught.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) ist bereits in LIBCMT.lib(stdexcpt.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) ist bereits in LIBCMT.lib(stdexcpt.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strncmp ist bereits in LIBCMT.lib(strncmp.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strchr ist bereits in LIBCMT.lib(strchr.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) ist bereits in LIBCMT.lib(stdexcpt.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _memmove ist bereits in LIBCMT.lib(memmove.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _free ist bereits in LIBCMT.lib(free.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _realloc ist bereits in LIBCMT.lib(realloc.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _malloc ist bereits in LIBCMT.lib(malloc.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &,int)" (??0exception@std@@QAE@ABQBDH@Z) ist bereits in LIBCMT.lib(stdexcpt.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _getenv_s ist bereits in LIBCMT.lib(getenv.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _exit ist bereits in LIBCMT.lib(crt0dat.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fflush ist bereits in LIBCMT.lib(fflush.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fprintf ist bereits in LIBCMT.lib(fprintf.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: ___iob_func ist bereits in LIBCMT.lib(_file.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strncpy_s ist bereits in LIBCMT.lib(strncpy_s.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strcpy_s ist bereits in LIBCMT.lib(strcpy_s.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isspace ist bereits in LIBCMT.lib(_ctype.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __errno ist bereits in LIBCMT.lib(dosmap.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __ftelli64 ist bereits in LIBCMT.lib(ftelli64.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _lseeki64 ist bereits in LIBCMT.lib(lseeki64.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: memchr ist bereits in LIBCMT.lib(memchr.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __get_osfhandle ist bereits in LIBCMT.lib(osfinfo.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isupper ist bereits in LIBCMT.lib(_ctype.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isalpha ist bereits in LIBCMT.lib(_ctype.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isdigit ist bereits in LIBCMT.lib(_ctype.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __control87 ist bereits in LIBCMT.lib(_ieee87
    .obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __clearfp ist bereits in LIBCMT.lib(_ieee87
    .obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __fseeki64 ist bereits in LIBCMT.lib(fseeki64.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __close ist bereits in LIBCMT.lib(close.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fclose ist bereits in LIBCMT.lib(fclose.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __read ist bereits in LIBCMT.lib(read.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __write ist bereits in LIBCMT.lib(write.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fwrite ist bereits in LIBCMT.lib(fwrite.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __fileno ist bereits in LIBCMT.lib(fileno.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __open_osfhandle ist bereits in LIBCMT.lib(osfinfo.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strerror ist bereits in LIBCMT.lib(strerror.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __flushall ist bereits in LIBCMT.lib(fflush.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _sscanf_s ist bereits in LIBCMT.lib(sscanf.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _calloc ist bereits in LIBCMT.lib(calloc.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _longjmp ist bereits in LIBCMT.lib(longjmp.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strstr ist bereits in LIBCMT.lib(strstr.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _sprintf ist bereits in LIBCMT.lib(sprintf.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _atof ist bereits in LIBCMT.lib(atof.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _vfprintf ist bereits in LIBCMT.lib(vfprintf.obj) definiert.
    1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) ist bereits in LIBCMT.lib(typinfo.obj) definiert.
    1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) ist bereits in LIBCMT.lib(typinfo.obj) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __vsnprintf_s ist bereits in LIBCMT.lib(vsnprnc.obj) definiert.
    1>cr_lib.lib(cr_lib.obj) : error LNK2005: "public: void __thiscall std::_Container_base0::_Swap_all(struct std::_Container_base0 &)" (?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z) ist bereits in msvcprt.lib(MSVCP100.dll) definiert.
    1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _printf ist bereits in LIBCMT.lib(printf.obj) definiert.
    1>LIBCMT.lib(timeset.obj) : error LNK2005: __get_tzname ist bereits in MSVCRT.lib(MSVCR100.dll) definiert.
    1>LIBCMT.lib(tzset.obj) : error LNK2005: __tzset ist bereits in MSVCRT.lib(MSVCR100.dll) definiert.
    1>LIBCMT.lib(wgetcwd.obj) : error LNK2005: __wgetdcwd ist bereits in MSVCRT.lib(MSVCR100.dll) definiert.
    1>LINK : warning LNK4098: Standardbibliothek "MSVCRT" steht in Konflikt mit anderen Bibliotheken; /NODEFAULTLIB:Bibliothek verwenden.
    1>QtCore.lib(qeventdispatcher_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_WSAAsyncSelect@16".
    1>QtGui.lib(qaccessible_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp__PlaySoundW@12".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmGetDefaultIMEWnd@4".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmGetContext@4".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmReleaseContext@8".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmNotifyIME@16".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmGetCompositionStringW@16".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmAssociateContext@8".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmSetCandidateWindow@8".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmSetCompositionWindow@8".
    1>QtGui.lib(qwininputcontext_win.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "_ImmSetCompositionFontW@8".

    Ansonsten findet er vorher bei meiner eigenen Bibliothek noch folgendes, was ich nicht nachvollziehen kann:

    1> HUB_Base.lib(GAMA.obj) : Es wurde ein mit /GL kompiliertes MSIL .netmodule oder module gefunden. Verknüpfung wird mit /LTCG erneut gestartet. Fügen Sie /LTCG zur Linkbefehlszeile hinzu, um die Linkerleistung zu erhöhen.



  • Setze in den Linkeroptionen (Kommandozeile) folgende Flags:

    /FORCE:MULTIPLE /IGNORE:4006 /NODEFAULTLIB:libcmt.lib
    


  • Hey, das Problem lag darin, dass QT übernacht noch einmal neu installiert habe, und dummerweise beim zweiten Kompilieren vergessen hatte, das Makefile auf MT anzupassen.

    Danach hatte ich immer noch Linker-Errors, die ich unter anderem mit Tricks wie dem von Berti lösen konnte.


Anmelden zum Antworten