C++ Linkerprobleme

badday

Commander
Registriert
Sep. 2007
Beiträge
3.023
Moin zusammen,

ich versuche seit gestern, mein Projekt auf Windows zu portieren, scheitere aber nach wie vor am linken einiger Bibliotheken. Konkret brauche ich folgende libs: boost_system, boost_filesystem, curllib und crypto++.
Daher habe ich in einem Unterordner meines Projekt folgende Dateien:
boost_filesystem-vc90-mt-1_42.dll
boost_filesystem-vc90-mt-1_42.lib
boost_filesystem-vc90-mt-gd-1_42.dll
boost_filesystem-vc90-mt-gd-1_42.lib
boost_system-vc90-mt-1_42.dll
boost_system-vc90-mt-1_42.lib
boost_system-vc90-mt-gd-1_42.dll
boost_system-vc90-mt-gd-1_42.lib
cryptlib.lib
curllib.lib
libboost_filesystem-vc90-mt-1_42.lib
libboost_filesystem-vc90-mt-gd-1_42.lib
libboost_filesystem-vc90-mt-s-1_42.lib
libboost_filesystem-vc90-mt-sgd-1_42.lib
libboost_filesystem-vc90-s-1_42.lib
libboost_filesystem-vc90-sgd-1_42.lib
libboost_system-vc90-mt-1_42.lib
libboost_system-vc90-mt-gd-1_42.lib
libboost_system-vc90-mt-s-1_42.lib
libboost_system-vc90-mt-sgd-1_42.lib
libboost_system-vc90-s-1_42.lib
libboost_system-vc90-sgd-1_42.lib
Die Boost-Dateien habe ich mithilfe von http://www.boostpro.com/ dorthin gepackt.

Ich verwende das VS 2008 Professional. Darin habe ich unter Project/Configuration Properites/Linker/General bei Additional Library Directories das Verzeichnis angegeben, das die oben genannten Dateien enthält.
Dann treten einige Probleme auf:
Code:
main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::Filter::Initialize(class CryptoPP::NameValuePairs const &,int)" (?Initialize@Filter@CryptoPP@@UAEXABVNameValuePairs@2@H@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall CryptoPP::Filter::Flush(bool,int,bool)" (?Flush@Filter@CryptoPP@@UAE_N_NH0@Z)
Dies ist nur ein kleiner Ausschnitt. Wenn ich nun die lib cryptlib.lib explizit unter Project/Configuration Properites/Linker/Input bei Additional Dependencies angebe, so scheint die lib soweit in Ordnung. Nun habe ich z. B. folgende Meldung:
error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function "bool __cdecl updateFile(class std::basic_string,class std::allocator
Daher das selbe Spiel mit libcurl.lib wie zuvor mit cryptlib.lib.

Nun tritt z. B. folgendes auf:
LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRTD.lib(MSVCR90D.dll)
Daher trage ich unter Project/Configuration Properites/Linker/Input bei Ignore Specific Library libcmtd.lib ein, wie bei http://support.microsoft.com/kb/148652 beschrieben. Danach tritt beispielhaft

Code:
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::operator+=(char const *)" (??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in cryptlib.lib(filters.obj)

...

libcpmtd.lib(locale0.obj) : error LNK2005: "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::operator=(char const *)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
auf. Daher füge ich diese zu den ignorierten libs hinzu. Das resultiert z. B. in
Code:
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::operator+=(char)" (__imp_??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@D@Z) referenced in function "public: class std::basic_string,class std::allocator > const __thiscall boost::filesystem::basic_path,class std::allocator >,struct boost::filesystem::path_traits>::file_string(void)const " (?file_string@?$basic_path@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@QBE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
libboost_filesystem-vc90-mt-gd-1_42.lib(operations.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::operator+=(char)" (__imp_??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@D@Z)

Soweit bin ich nun und eine Lösung scheint nicht in Sicht. Wenn mir irgendjemand weiterhelfen kann, oder auch nur meint, es zu können, ich bin für jeden Tipp dankbar.

Soweit mein bisher wohl längster Threaed;)

Vielen Dank.


Gruß,

badday


EDIT: OK, das lag offenbar daran, dass ich die MSVC runtime nicht auf /MTd gestellt hatte. Nun beschwert er sich, dass die curllib.dll fehle. Kann ich irgendwo angeben, wo er nach der dll zu schauen hat? Bzw. kann ich vermeiden, dass er auf die dll zurückgreift, indem ich statisch linke?
 
Zuletzt bearbeitet:
Wenn du statisch linkst, dann sollte er nicht auf die dll zugreifen, richtig. Allerdings nehme ich an, daß du dann eine andere .lib verlinken mußt. Ansonsten schieb die dll einfach mal in das Verzeichnis, wo der Linker die .exe ablegt und probier aus, ob es dann geht.
 
Ich habe leider immer noch ein Problem mit libcurl. Ich habe hier noch einmal geschaut: http://curl.haxx.se/docs/faq.html#Li...uilding_libcur und die lib selber gebaut - erfolgreich. Nun ist aber immer noch das Problem, dass, wenn ich das ganze kompiliere, es nach wie vor "unresolved external symbols" gibt, wie z. B. _imp_curl_easy_cleanup.
Ich habe libcurld.lib vorliegen und linke sie auch, aber offenbar sind diese Symbole dort nun enthalten.

Weiß jemand weiter?

Danke.

Gruß,

badday
 
Zurück
Oben