Search code examples
c++windowsqtvisual-studio-2017qtplugin

Use a QT Widget plugin using static qmake


i have built an QT GUI app using Visual Studio 2017 with Qt VS Tools extension and QT version 5.6 (the one provided by QT precompiled), using Qled widget plugin.

With this Default Dynamic Qt version, the app runs fine with the widget and i have no problems.

But now, i want to build the same app, but static, for use without dependencies. So, i built QT 5.6 from source with -static parameter, to be more exact i follow this blog's guide. Here problems started to show up:

  1. I tried to rebuild the widget plugin using the static qmake, but i got this error: "Project ERROR: Unknown module(s) in QT: designer"
  2. I tried to use the plugin compiled by the dynamic qmake, and surprisingly, it built with success but the GUI app didn't open at all.

Its worth mentioning that i can use and build a simple default application using a qmake static build.

I think i need to add the Qt Designer Module, but i don't know how to do this, i even tried to rebuild qmake without the "-nomake tools" paramter, but got the same error building the plugin.


Solution

  • just don't build the plugin, you don't need it. Just add the qrc file, and the actual widget *.cpp and *.h file into your project

    fix the linkage, delete the QDESIGNER_WIDGET_EXPORT in the *.h file inside your project

    This comment managed to solved my problem, thanks to @PeterT