Eclipse中的Crypto ++未定义参考 [英] Crypto++ in Eclipse Undefined Reference

查看:67
本文介绍了Eclipse中的Crypto ++未定义参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MinGW工具链将Crypto ++用于我的Eclipse C ++项目.问题是,每当我尝试使用加密函数时,都会出现未定义的引用"错误.有谁之前经历过这个吗?这就是我得到的(被截断):

I'm trying to use Crypto++ for my Eclipse C++ project using the MinGW toolchain. Problem is, whenever I try to use crypto functions, I get flooded with "undefined reference" errors. Has anyone experienced this before? This is the what I'm getting (truncated):

已更新

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)'

推荐答案

您的 -L 位于引号内.您是否尝试过:

your -L is inside of your quotes. Have you tried:

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

现在,g ++知道在哪里可以找到您的库了,您还需要从 C:\ Libraries \ crypto ++ 目录中指定要使用的库:

Now that g++ know where to look for your libs, you'll also need to specify which libs from the C:\Libraries\crypto++ directory you'd like to use:

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

这篇关于Eclipse中的Crypto ++未定义参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆