Qt application fails to load custom plugin debug library
|May 9, 2014||Posted by forumadmin under TechQns||
Why does my test application, when running in Release, not load the Debug (-d) version of my plugin DLL and instead only load the Release version?
I’m building a custom Qt Designer plugin, QDragableToolBox; I am testing it with a very simple Qt application. I link to my plugin library as shown in the .pro code below.
My plugin works fine in Release mode. When I attempt to run in Debug, the test application fails to get past the constructor of the plugin and simply ends without warning or error. I have seen this before with Debug/Release library conflicts and therefore used Dependency Walker to check which library the executable is searching for. Sure enough, it is looking for the Release library, not the Debug library as appended with ‘d’.
I have further confirmed that this is the case by removing the ‘d’ from the filename of the Debug DLL. When that is done, the test application runs perfectly. I know that it is in fact loading the Debug library in this case as I have included a message box popup stating the library type (Debug vs. Release).
I can post the actual code if need be, but I don’t think that it relates to the problem because Release works fine.
Here are my project files:
Plugin library .pro:
QT += widgets designer QMAKE_LFLAGS += /INCREMENTAL:NO TARGET = $$qtLibraryTarget($$TARGET) TEMPLATE = lib CONFIG += plugin CONFIG += debug_and_release target.path = $$[QT_INSTALL_PLUGINS]/designer INSTALLS += target HEADERS = qdragabletoolbox.h \ qdragabletoolboxplugin.h \ qdragabletoolboxextensionfactory.h \ qdragabletoolboxcontainerextension.h SOURCES = qdragabletoolbox.cpp \ qdragabletoolboxplugin.cpp \ qdragabletoolboxextensionfactory.cpp \ qdragabletoolboxcontainerextension.cpp RESOURCES += qdragabletoolbox.qrc OTHER_FILES += qdragabletoolbox.json
Test executable .pro:
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets QMAKE_LFLAGS += /INCREMENTAL:NO TARGET = QDesignerPluginTester TEMPLATE = app CONFIG += debug_and_release LIBS += -LF:/Custom_Plugins/QDragableToolBox/output -lQDragableToolBox LIBS += -LF:/Custom_Plugins/QMultiPageWidget/output -lQMultiPageWidget LIBS += -LF:/Custom_Plugins/QLED/output -lQLED SOURCES += main.cpp\ testwidget.cpp HEADERS += testwidget.h FORMS += \ testwidget.ui
|Asked By – GregD||Read Answers|