QT - specify the DLL path in pro. file

Since the title of the question says, I just wonder how to include the path to the DLL file in the project file. I know that it is better to use a DLL file with a project file, but I would like to know if this is possible?

Currently, my .pro file consists of the following:

QT       += core gui

TARGET = Test
TEMPLATE = app

win32 {
    INCLUDEPATH += "D:/Projects/Build Output/include/"

    CONFIG(debug, debug|release) {
        LIBS += "D:/Projects/Build Output/libs/debug/myLib.lib"
        LIBS += "D:/Projects/Build Output/bin/x86 debug/myLib.dll"
    } 
    else {
        LIBS += "D:/Projects/Build Output/libs/release/myLib.lib"
        LIBS += "D:/Projects/Build Output/bin/x86 release/myLib.dll"
    }
}

SOURCES += main.cpp\
    mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

It would be great just to know that this can be done, in advance for your help :).

+5
source share
3 answers

, exe dll , dll (.. .lib , ). Windows , DLL. QT pro. QT know DLL .lib/.a :

 LIBS += "D:/Projects/Build Output/bin/x86 debug/myLib.dll"

dll pro. LoadLibrary DLL c/++. , ,

+2

You do not need to specify the dll path in the .pro file (windows). All you have to do is put all external DLL files in a directory and add this directory to the path environment variable. (same as accepted answer). I am adding this here to mention an important fact: RESTART QT CREATOR for this to reload the new PATH environment variable.

0
source

All Articles