Question

I am currently trying to run Crypto++ in my Qt Application. But it does not work. Hopefully somebody of you knows whats wrong, because I have not figured it out and I am on this for 3 days now.

To concentrate the problem, I have created a test app. Holding this code: http://pastebin.com/1XMARtds taken from http://programmingknowledgeblog.blogspot.de/2013/04/compiling-and-integrating-crypto-into.html

My .pro looks like this:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Savor_V100/libraries/ -lcryptlib
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../Savor_V100/libraries/ -lcryptlibd
else:unix: LIBS += -L$$PWD/../Savor_V100/libraries/ -lcryptlib

INCLUDEPATH += $$PWD/../Savor_V100/includes/cryptopp562
DEPENDPATH += $$PWD/../Savor_V100/includes/cryptopp562

I have compiled the library with MS Visual Studio 2012. When I use these settings: http://i.imgur.com/Nd9TEIA.png

I get a single 50mb-ish .lib file.

When I then try to build my application in Qt Creator (5.0.2) I get the following: http://i.imgur.com/RbCGQDU.png

A lot of:

cryptlib.lib(cryptlib.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj

It also says: File not found: cryptlib.lib(cryptlib.obj)

If I put the .obj files in the same folder as the .lib file I get rid of the "file not found" errors. But nothing else changes.

Could somebody please explain what I am doing wrong ? The LNK2038 info on the website does not help me:(

Was it helpful?

Solution

Step 7 of the instructions you linked to here appear to be strange. Normally you'd select /MD and /MDd for Release and Debug respectively, or you'd select /MT and /MTd.

The crux is that you have your Release build of crypto linked to the Dynamic version of the C Runtime Library (via /MD), but your test exe is set to link to the Static version (via /MT).

You should only link to a single version of the CRT - i.e. recompile crypto++ in Release mode with /MT set instead of /MD, or change your test exe to use /MD.

For further info on these flags, see the msdn docs.

OTHER TIPS

Who wants to run crypto++ on linux(I did on ubuntu), after downloading library via apt-get install, should add to pro file this:
LIBS += -L/usr/lib/crypto++ -lcrypto++ Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top