PDA

View Full Version : HELP! Need to run cryptopp from Qt Creator



irin.gen
11th August 2011, 18:39
Hello,
I have cryptopp 5.3.0 and try to run it from Qt Creator 2.1.0 (Qt 4.7.2).
I have cryptopp.dll and cryptopp.lib downloaded from Crypto++ site.

Any attempt to run any code from cryptopp library results in LINKER error (LNK2001).

I will appreciate any help (like example or hint or link).

The .pro file is:

#-------------------------------------------------
#
# Project created by QtCreator 2011-08-11T15:29:52
#
#-------------------------------------------------

QT += core
QT -= gui

TARGET = Testik

CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

LIBS += -Lcryptopp

And my main.cpp (there is no more files):

#include <iostream>

#define CRYPTOPP_DEFAULT_NO_DLL
#include <cryptopp/dll.h>
#ifdef CRYPTOPP_WIN32_AVAILABLE
#include <windows.h>
#endif
#include <cryptopp/md5.h>

int main(int argc, char *argv[])
{

byte digest[ CryptoPP::MD5::DIGESTSIZE ];
CryptoPP::HexEncoder encoder;

return 0;
}

ChrisW67
12th August 2011, 00:49
Your LIBS setting is incorrect. Try:


LIBS += -L/path/to/CryptoPP/lib_dir -lcryptopp

(lib_dir contains cryptopp.lib)

You are possibly also missing an INCLUDEPATH, but if you get through compilation without it then the CryptoPP headers must be in a default location.

Cyrebo
24th April 2013, 22:08
Hello I too am having problems including cryptopp in qt creator...I have an include path and the path set just like you described chris. I try different methods and I get linker errors, debug/exe errors, cannot find cryptopp.h...don't know what debug/exe error is.

this is my current include


INCLUDEPATH += <C:\Users\myname\Documents\cryptoProject\cryptopp>
LIBS += -L/path/to/CryptoPP/lib_dir -lcryptopp

The funny thing is when i hover over the includes in my mainwindow.cpp it shows the crypto includes directory...

ChrisW67
25th April 2013, 00:06
Line 1: "<C:\Users\myname\Documents\cryptoProject\cryptopp>" is not a file path. Lose the "<" and ">" and switch all the "\" to "/". If the path contains spaces then you need to enclose it in quotes or move the library to somewhere without spaces in the path.
Line 2: You are supposed to replace "/path/to/CryptoPP/lib_dir" with the actual path you the directory containing the Crypto++ library