Link Cryptlib Library with Qt creator

  • I have Qt Creator 2.6.1 based on Qt 5.0 I have build cryptlib with visual studio 2010

    all cryptlib project is on C:\SDK\cl342 when I have built the project the crypt.h and cl32.lib and cl32.dll are in this folder C:\SDK\cl342

    I am getting linker error on every method that I call from cryptlib such as cryptInit I have tried adding it from the project menu and add external library it makes many changes to pro file but does not even let me include crypt.h.

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cryptEnd@0 referenced in function "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QAE@PAVQWidget@@@Z) –

    my pro files looks something like this.

    QT += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    TARGET = testlistview
    TEMPLATE = app
    SOURCES += main.cpp
    HEADERS += mainwindow.h
    FORMS += mainwindow.ui
    INCLUDEPATH = C:\SDK\cl342
    DEPENDPATH += C:\SDK\cl342
    LIBS += C:\SDK\cl342\cl32.lib

  • Maybe try:
    INCLUDEPATH += C:\SDK\cl342\ #add a + sign
    LIBS += -LC:\SDK\cl342\cl32.lib -lcl32

    else looks ok


  • That would be:
    LIBS += -LC:/SDK/cl342 -lcl32


    LIBS += C:/SDK/cl342/cl32.lib

    (Get out of the habit of using backslashes in pro files and you will avoid the qmake warnings about unescaped backslashes)

    Are you sure of the library name? cl32 not cl342 perhaps?
    Is the project being built with the same compiler you used for the library? If not you might have a binary format mismatch issue: MSVC++ lib files are not useful in MingW builds.

  • well either of the above didn't work I still get the same error.
    I made sure the lib and the dll names are cl32.lib, cl32.dll

    more over I found out there is another folder there
    and here I found the libs with same name as well and tried to access them the above mentioned way.

    I am not doing any thing with the MingW I guess, I built cryptlib with Visual Studio and settings in Qt Creator for my test project are
    qmake.exe C:\Qt\Qt5.0.0\Tools\QtCreator\bin\testlistview\ -r -spec win32-msvc2010

    more over I have a strange issue that if try compiling my Qt application in Debug it gives me crypt.h not found error
    error: C1083: Cannot open include file: 'crypt.h': No such file or directory
    at the same time when I switch to debug it gives me no header error but if I switch to release configuration I get this linker error.

  • I tried using the right click and Add-library option as well that wrote the following lines in my .pro file
    more over built cryptlib to be a static lib

    unix|win32: LIBS += -L$$PWD/../../../../../../SDK/cl342/binaries32_vs10/ -lcl32

    INCLUDEPATH += $$PWD/../../../../../../SDK/cl342
    DEPENDPATH += $$PWD/../../../../../../SDK/cl342

    win32: PRE_TARGETDEPS += $$PWD/../../../../../../SDK/cl342/binaries32_vs10/cl32.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../../../../../SDK/cl342/binaries32_vs10/libcl32.a

    but to no use the error is still same

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.