I am trying to use crypto++ on windows in my Qt Creator project. I am using qmake, so I have a .pro file and have included the following lines:
INCLUDEPATH += "C:\Users\username\Downloads\cryptopp880"
DEPENDPATH += "C:\Users\username\Downloads\cryptopp880"
LIBS += "-LC:\Users\username\Downloads\cryptopp880\x64\Output\Release\cryptlib.lib"
However, when I try to build my project I receive 400+ undefined reference errors which references all of the functions I have used in my code. Something like:
undefined reference to 'CryptoPP::Algorithm::Algorithm(bool)'
C:\Users\username\Downloads\cryptopp880\cryptlib.h
I don't understand why these are undefined references, as the cryptlib.lib file should elucidate all of these to the linker.
I have tried rebuilding the cryptlib.lib files using the Properties>C/C++>Runtime Library>Multi-threaded Debug DLL version (which I have found online is the correct version for Qt). I have also tried changing the Configuration properties of my build to the C++17 version which is consistent with my Qt project. Both of these changes were done in Visual Studio.
I also tried including the library using the Qt GUI instead of manual .pro file editing.
None of these changes fixed the problem. Many answers online reference "libcryptopplib.a" which is a file that I do not build when using Visual Studio, although I think that cryptlib.lib should work the exact same way.
Solved. The problem was that I was compiling crypto++ with visual studio, but my Qt application was compiled using mingw64 and gcc. To fix the problem, I downloaded msys2 and opened mingw64. Then I opened my crypto++ directory and 'make' which resulted in libcryptopp.a, and using this in my project works.
https://groups.google.com/g/cryptopp-users/c/Q8_6mSS5ZSw was super helpful in solving.