Qt plugins do not work

I created a special widget plugin. The plugin integrates perfectly with Qt Creator, but when I compile the program, I get this error:

"test.h: There is no such file or directory"

Where test.h is the name of the custom widget. What am I doing wrong? This is the application * .pro file:

TEMPLATE = app
SOURCES += main.cpp \
    mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui

This is the plugin * .pro file:

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)
+3
source share
3 answers

After extensive research, I came across this topic:

http://www.archivum.info/ qt-interest@trolltech.com /2010-02/01398/Re-%28Qt-interest%29-Undefined-reference-to-%28any-custom-widget%29.html

, , "dll", , Qt Creator/Qt Designer. . , , . , , :

  • , . A. .
  • Qt Creator/Designer. , , Qt Creator/Designer.
  • *.pro:

    LIBS + = C:\[ ]
    INCLUDEPATH + = C:\[PATH TO LIBRARY HEADERS]

, A, , .

+4

, , . , , , , . , , :

  • , , , .
  • , , .
+1

I ran into the same problem. Then I tried to add all the header and .cpp files from the plugin DLL to the application project file explicitly. The problem is fixed.

0
source

Source: https://habr.com/ru/post/1737927/


All Articles