Hello, I may be doing something incorrectly, if so I apologize and look forward to being corrected. However, whenever I link against libcrypto, I get undefined reference errors. Here's what I've done, step by step.
1) Install Cygwin x86_64 2) Install Cygwin packages: * make * x86_64-w64-mingw32-gcc * x86_64-w64-mingw32-g++ * git * wget * nano * diffutils 3) cd /home/user/my_app 4) git clone https://github.com/weidai11/cryptopp && cd cryptopp 5) make 6) make test 7) mkdir -p include/cryptoppp 8) mkdir lib 9) cp *.h include/cryptopp 10) cp *.a lib 11) cd /home/user/my_app 12) echo "test 1 2 3" > test.txt 13) nano test.cpp ------------------------------------------ /* Simple test application for Crypto++ */ // Include Crypto++ headers #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 // For MD5 hash function #include <cryptopp/md5.h> #include <cryptopp/hex.h> #include <cryptopp/files.h> // Include standard headers #include <string> #include <iostream> std::string filename = "test.txt"; std::string result; // set global result var // ======================= // Hash Function by button // ======================= int main() { // Start MD5 Hashing process CryptoPP::Weak::MD5 hash; CryptoPP::FileSource(filename.c_str(),true, new CryptoPP::HashFilter(hash, new CryptoPP::HexEncoder( new CryptoPP::StringSink(result), true))); // Print result to terminal std::cout << result << std::endl; } -------------------------------------------- 14) x86_64-w64-mingw32-g++.exe std=c++14 -o test test.cpp -I/home/user/my_app/cryptopp/include/ -L/home/user/my_app/cryptopp/lib/ -lcryptopp 15) Get this nasty result: ---- /tmp/ccL1UIhb.o:test.cpp:(.text+0x8c): undefined reference to `CryptoPP::StringSinkTemplate<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::StringSinkTemplate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' /tmp/ccL1UIhb.o:test.cpp:(.text+0x171): undefined reference to `CryptoPP::HashFilter::HashFilter(CryptoPP::HashTransformation&, CryptoPP::BufferedTransformation*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccL1UIhb.o:test.cpp:(.text$_ZN8CryptoPP23FilterWithBufferedInput4Put2EPKhyib[_ZN8CryptoPP23FilterWithBufferedInput4Put2EPKhyib]+0x48): undefined reference to `CryptoPP::FilterWithBufferedInput::PutMaybeModifiable(unsigned char*, unsigned long long, int, bool, bool)' /tmp/ccL1UIhb.o:test.cpp:(.text$_ZN8CryptoPP23FilterWithBufferedInput14PutModifiable2EPhyib[_ZN8CryptoPP23FilterWithBufferedInput14PutModifiable2EPhyib]+0x48): undefined reference to `CryptoPP::FilterWithBufferedInput::PutMaybeModifiable(unsigned char*, unsigned long long, int, bool, bool)' /tmp/ccL1UIhb.o:test.cpp:(.text$_ZN8CryptoPP17SimpleProxyFilterC2EPNS_22BufferedTransformationES2_[_ZN8CryptoPP17SimpleProxyFilterC2EPNS_22BufferedTransformationES2_]+0x35): undefined reference to `CryptoPP::ProxyFilter::ProxyFilter(CryptoPP::BufferedTransformation*, unsigned long long, unsigned long long, CryptoPP::BufferedTransformation*)' [truncated] ---- Full Log: https://8n1.org/raw/12425/afb6 Is this a bug, or am I linking against libcryptopp.a the wrong way? Thanks, Bob -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
