Reputation: 821
I've created a custom widget plugin. The plugin integrates fine with Qt Creator but when I compile the program, I'm getting this error:
"test.h: No such file or directory"
Where test.h is the name of the custom widget. What am I doing wrong? This is the *.pro file of the application:
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
This is the *.pro file of the plugin:
CONFIG += designer plugin debug_and_release
TARGET = $$qtLibraryTarget(testplugin)
TEMPLATE = lib
HEADERS = testplugin.h
SOURCES = testplugin.cpp
RESOURCES = icons.qrc
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
include(test.pri)
Upvotes: 3
Views: 3339
Reputation: 1
I faced with same issue. Then i tried to add all header files and .cpp files of plugin DLL into applications project file explicitly.it fixed the issue.
Upvotes: 0
Reputation: 821
After extensive research, I stumbled upon this thread:
It turns out that when you compile a plugin, the "dll" that you get is only for Qt Creator/Qt Designer integration purposes. You CANNOT link against that library. You should provide another library that contains the headers and the source code or include them in your project. So, to sum up, here are the proper steps to deploy a custom widget:
In your project, you must add the following lines to the *.pro file:
LIBS += C:\[PATH TO LIBRARY'S A BINARY]
INCLUDEPATH += C:\[PATH TO LIBRARY'S A HEADERS]
Notice once again that you are linking to library A, NOT to the library that you get when you compile the widget plugin.
Upvotes: 5
Reputation: 14941
If you can see your widget in designer, your plugin is working the way you've specified it to. Your problem is basically that the program you're compiling can't find the header file for the widget you are adding via the plugin. The answer is likely one of two things:
Upvotes: 1