Search code examples
c++qtcrypto++

LNK2001 errors when trying to using CryptoPP lib in a Qt Project


I am trying to use CryptoPP lib in a Qt project. I first built Crytplib using Visual C++ 2019. I changed Runtime options to MDd (Multithread Debug DLL). It generated cryptlib.lib.

In Qt, I added:

LIBS += -L$$PWD/../libs/CryptoPP/x64/Output/Release/ -lcryptlib
INCLUDEPATH += $$PWD/../libs/CryptoPP

Compiling gives the following errors:

cryptlib.lib(keccak_core.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(ecp.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(rng.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(rijndael_simd.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(des.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(gfpcrypt.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(hmac.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(gf2n.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(ec2n.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(modes.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(oaep.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(sha3.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(pssr.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(nbtheory.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(sha_simd.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(rijndael.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(hrtimer.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(base64.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(files.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(mqueue.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(dll.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(pubkey.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(pkcspad.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(asn.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(rsa.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(iterhash.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(sha.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(randpool.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(osrng.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(algparam.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(queue.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(basecode.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(hex.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(cryptlib.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(misc.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(filters.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(integer.obj) : error LNK2001: symbole externe non résolu __CxxFrameHandler4
cryptlib.lib(keccak_core.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(ecp.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(rng.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(rijndael_simd.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(des.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(gfpcrypt.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(hmac.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(gf2n.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(ec2n.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(modes.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(oaep.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(sha3.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(pssr.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(nbtheory.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(sha_simd.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(rijndael.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(hrtimer.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(base64.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(files.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(mqueue.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(dll.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(pubkey.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(pkcspad.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(asn.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(rsa.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(iterhash.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(sha.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(randpool.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(osrng.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(algparam.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(queue.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(basecode.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(hex.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(cryptlib.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(misc.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(filters.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(integer.obj) : error LNK2001: symbole externe non résolu __GSHandlerCheck_EH4
cryptlib.lib(integer.obj) : error LNK2019: symbole externe non résolu __std_reverse_trivially_swappable_1 référencé dans la fonction "void __cdecl std::reverse<unsigned char *>(unsigned char * const,unsigned char * const)" (??$reverse@PEAE@std@@YAXQEAE0@Z)
debug\prxQWT.exe : fatal error LNK1120: 3 externes non résolus

It seems that a lot of people are having trouble to make it work with Qt, and no one seems to have the correct way to do it. By the way, I am using Qt 5.12.0.


Solution

  • I finally solved this. It was due to the fact that I was building Crypto++ with MSVC2019 while Qt was built with MSVC2015.