How to set the location to load library files
-
###################### MainWidget ###################### # ---------------------------------------------------- # This file is generated by the Qt Visual Studio Tools. # ------------------------------------------------------ QT += core gui widgets CONFIG += c++11 TEMPLATE = app TARGET = MainWidget MOC_DIR += . OBJECTS_DIR += debug UI_DIR += . RCC_DIR += . include(MainWidget.pri) # �쇱�踰�由ы����Depoly unix { target.path = /home/pi/QT_Execfiles INSTALLS += target } # �ㅽ������������移� CONFIG(debug, debug|release) { DESTDIR = $$PWD/../Depoly_Exec/debug } else { DESTDIR = $$PWD/../Depoly_Exec/release } #win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Depoly_Exec/release/ -lCustomIndicator #else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator #else:unix:!macx: LIBS += -L$$PWD/../Depoly_Exec/ -lCustomIndicator LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator INCLUDEPATH += $$PWD/../Depoly_Exec/debug DEPENDPATH += $$PWD/../Depoly_Exec/debug ###################### CustomIndicator ###################### # ---------------------------------------------------- # This file is generated by the Qt Visual Studio Tools. # ------------------------------------------------------ QT += gui core widgets TEMPLATE = lib DEFINES += CUSTOMINDICATOR_LIB TARGET = CustomIndicator CONFIG += c++11 SOURCES += ./CustomIndicator.cpp HEADERS += ./customindicator_global.h \ ./CustomIndicator.h # �ㅽ������������移� CONFIG(debug, debug|release) { DESTDIR = $$PWD/../Depoly_Exec/debug } else { DESTDIR = $$PWD/../Depoly_Exec/release }
I want to create a dll file normally and load the file in MainWidget
Can you see if the way I did it is right?
When I try to declare CustomIndicator in the include header, it says the file cannot be found.In the Depoly_Exec folder, I could confirm that the dll file and lib file were created normally.
-
@IknowQT said in How to set the location to load library files:
LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator
INCLUDEPATH += $$PWD/../Depoly_Exec/debug
DEPENDPATH += $$PWD/../Depoly_Exec/debugYou want to search for header files in deployment folder?
The proper way to manage this is to use https://wiki.qt.io/SUBDIRS_-_handling_dependencies
-
@IknowQT said in How to set the location to load library files:
What's the reason you can't load it?
Load what?
Please ask understandable questions. -
@IknowQT You simply need to specify your project dependencies.
Your MainWidget depends on CustomIndicator.
In the link a gave you is one example (last line):TEMPLATE = subdirs SUBDIRS = \ lib2 \ # sub-project names lib \ app # where to find the sub projects - give the folders lib2.subdir = src/lib2 lib.subdir = src/lib app.subdir = src/app # what subproject depends on others app.depends = lib lib2
-
############ main.pro file ############ # ---------------------------------------------------- # This file is generated by the Qt Visual Studio Tools. # ------------------------------------------------------ # This is a reminder that you are using a generated .pro file. # Remove it when you are finished editing this file. message("You are running qmake on a generated .pro file. This may not work!") TEMPLATE = subdirs SUBDIRS += MainWidget/MainWidget.pro \ CustomIndicator/CustomIndicator.pro
Am I doing it right as you suggested?
-
@IknowQT said in How to set the location to load library files:
Am I doing it right as you suggested?
No.
Please read more carefully!
You specify the subfolders in SUBDIRS, not pro files.
And you did not specify the dependencies like shown in the example. Why?