Eclipse中的crypto++未定义引用

Crypto++ in Eclipse Undefined Reference

本文关键字:引用 未定义 crypto++ 中的 Eclipse      更新时间:2023-10-16

我正在尝试使用MinGW工具链为我的Eclipse c++项目使用Crypto++。问题是,每当我尝试使用加密函数时,我都会遇到"未定义引用"错误。有人经历过这种情况吗?这是我得到的(截断):

更新
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" 
srcGrum Net.o: In function `ZN8CryptoPP18HashTransformationD2Ev':
C:/Libraries/crypto++/cryptlib.h:531: undefined reference to `vtable for CryptoPP::HashTransformation'
srcGrum 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'
srcGrum Net.o: In function `ZN8CryptoPP31IteratedHashWithStaticTransformIjNS_10EnumToTypeINS_9ByteOrderELi0EEELj64ELj16ENS_5Weak13MD5ELj0ELb0EE4InitEv':
C:/Libraries/crypto++/iterhash.h:90: undefined reference to `CryptoPP::Weak1::MD5::InitState(unsigned int*)'
srcGrum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x18): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::Update(unsigned char const*, unsigned int)'
srcGrum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x1c): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned int&)'
srcGrum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x24): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::Restart()'
srcGrum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x44): undefined reference to `CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::TruncatedFinal(unsigned char*, unsigned int)'
srcGrum Net.o:Grum Net.cpp:(.rdata$_ZTVN8CryptoPP5Weak13MD5E[__ZTVN8CryptoPP5Weak13MD5E]+0x4c): undefined reference to `CryptoPP::HashTransformation::TruncatedVerify(unsigned char const*, unsigned int)'

您的-L在您的引号内。

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

现在g++知道在哪里寻找你的库,你还需要从C:Librariescrypto++目录中指定你想使用的库:

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