Qt and Crypto++ on windows
As the title says, I'm kinda having trouble using Crypto++ and Qt on windows. I've used them on my project, but always on unix platforms. Yesterday, I had to compile it under windows though. The problem is that I need to use sha512 hash, and Qt hashing class does not give support for it (it supports only md4, md5 and sha1, as you guys probably already know). So, I had to find an alternative, and, of course, it was Crypto++.
I downloaded the library on http://www.cryptopp.com/ and compiled it using the project it already comes with (it's a Visual Studio 2006 project, I opened it with Visual Studio 2008 and the program itself handled the conversion between 2006~2008). When it finished compiling it generated static and dynamic outputs (the first one contained only a .lib file, as usual, and the second one a .lib file - that should contain the references - and a .dll file). So, I opened my .pro file (which is built with Qt Creator) and added the line:
LIBS += -LC:/Qt/libs/others/ -lcryptopp
Both files (cryptopp.lib and cryptopp.dll) are inside the folder (C:/Qt/libs/others/). The thing is that when the project is finishing to compile and is linking against the libraries it generated a bunch of compiling errors, ALL of them about references (undefined reference to
vtableCryptoPP::hash...), like if the .lib file was not being linked at all (but it IS).
What do you guys think it could be? I tested both static and dynamic and both resulted on the same compiling errors (undefined references). I've already tried to do anything I could imagine, but I've had no success so far. Can you PLEASE help me? :P
You should check two things in the crypto++ solution
Configuration Debug: C/C++/Code Generation/Runtime Library -> Multi-threaded Debug DLL (/MDd)
Configuration Release: C/C++/Code Generation/Runtime Library -> Multi-threaded DLL (/MD)
And make sure that the "treat wchar as buildin type" setting is set to the same value as Qt.
if your problem is still unsolved, try this :
It worked well for me !
sehnkim last edited by
I know this topic is kind of old, but I followed the instructions by Kretikus but didn't work. So, I tried to use the link in your post, but it seems it is broken.
Can you give me some idea of how to solve the issue on your end?
Here is what I've done so far.
Even though the build was successful and the dll and lib were generated, there was this error. Do you know why I have the error?
error: LNK1107: invalid or corrupt file: cannot read at 0x2C0
I googled it and investigated the issue, and it turned out that the solution file (cryptest.sln) was not correct. I followed the following instructions.
But still I have the following errors.
mainwindow.obj:-1: error: LNK2001: unresolved external symbol "public: virtual unsigned __int64 __thiscall CryptoPP::ThreadUserTimer::GetCurrentTimerValue(void)" (?GetCurrentTimerValue@ThreadUserTimer@CryptoPP@@UAE_KXZ)
Is the following code correct?
INCLUDEPATH += "../extern/msvc2013/cryptopp562/include" LIBS += -L"../extern/msvc2013/cryptopp562/lib" -lcryptopp
Should I also add dll like this?
LIBS += -L"../build-user_account_registration-Desktop_Qt_5_6_0_MSVC2013_32bit-Release/release/cryptopp.dll"
Any help would be appreciated.
Thank you so much.