2012-12-27 40 views
1

我試圖使用加密+使用MinGW的工具鏈我的Eclipse C++項目。問題是,每當我嘗試使用加密函數時,都會遇到「未定義引用」錯誤。有誰之前經歷過這個嗎?這是什麼我得到(部分):加密+ Eclipse中未定義參考

修訂

g++ -L "C:\\Libraries\\crypto++\\Win32\\DLL_Output\\Debug" -lpthread -lcryptopp -o "Grum Net.exe" "src\\Vault\\VaultNode.o" "src\\User.o" "src\\Grum Net.o" 
src\Grum Net.o: In function `ZN8CryptoPP18HashTransformationD2Ev': 
C:/Libraries/crypto++/cryptlib.h:531: undefined reference to `vtable for CryptoPP::HashTransformation' 
src\Grum Net.o: In function `ZN8CryptoPP18HashTransformationC2Ev': 
C:/Libraries/crypto++/cryptlib.h:531: undefined reference to `CryptoPP::Algorithm::Algorithm(bool)' 
C:/Libraries/crypto++/cryptlib.h:531: undefined reference to `vtable for CryptoPP::HashTransformation' 
src\Grum Net.o: In function `ZN8CryptoPP31IteratedHashWithStaticTransformIjNS_10EnumToTypeINS_9ByteOrderELi0EEELj64ELj16ENS_5Weak13MD5ELj0ELb0EE4InitEv': 
C:/Libraries/crypto++/iterhash.h:90: undefined reference to `CryptoPP::Weak1::MD5::InitState(unsigned int*)' 
src\Grum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x18): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::Update(unsigned char const*, unsigned int)' 
src\Grum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x1c): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned int&)' 
src\Grum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x24): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::Restart()' 
src\Grum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x44): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::TruncatedFinal(unsigned char*, unsigned int)' 
src\Grum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x4c): undefined reference to `CryptoPP::HashTransformation::TruncatedVerify(unsigned char const*, unsigned int)' 

回答

1

-L是你的引號內。您是否嘗試過:

g++ -L "C:\\Libraries\\crypto++" -lpthread -o "Grum Net.exe" "src\\VaultNode.o" "src\\User.o" "src\\Grum Net.o" 

現在G ++知道到哪裏尋找你的庫,您還需要指定從Ç庫其中:\庫\加密++你想目錄使用方法:

g++ -L "C:\\Libraries\\crypto++" -lcryptolib1 -lcryptolib2 -lpthread -o "Grum Net.exe" "src\\VaultNode.o" "src\\User.o" "src\\Grum Net.o" 
+0

感謝的是,Eclipse的必須一直在做一些有趣的事情......我之前加一個空格「的配置,現在的說法出來正確,但未定義引用錯誤仍然存​​在 –

+0

我更新了問題提供更新的表達 –

+1

你是不是也包括你所需要的特定庫?如y使用-L它會告訴g ++ _where_查找庫,但不會使用哪個_。您還需要從您想要使用的_C:\\ Libraries \\ crypto ++ _中選擇-l。 – Foggzie