1

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.

Miguel
  • 49
  • 1
  • 7
  • 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 – PeterT Sep 10 '18 at 18:33
  • Just be aware that it's GPL software. So if you give your program to other people then you will need to give people the sourcecode of you application when they ask too. – PeterT Sep 10 '18 at 18:35
  • @PeterT But if i do that i can't use the plugin on QTDesigner or is there any workarround? – Miguel Sep 10 '18 at 18:55
  • use the dynamically linked plugin at design-time. That's just used to generate the xml for the *.ui file. That doesn't have to have anything to do with what you compile in the end. – PeterT Sep 10 '18 at 20:12
  • @PeterT Ok i tryied your suggestion, but now iam getting some Inconsistent linkage dll warnings and an error: "Error 'QLed::staticMetaObject': definition of dllimport static data member not allowed", on moc_qled.cpp – Miguel Sep 10 '18 at 20:42
  • 1
    just fix the linkage, delete the `QDESIGNER_WIDGET_EXPORT` in the *.h file inside your project – PeterT Sep 10 '18 at 20:51
  • @PeterT It is now fully working, thanks for the help – Miguel Sep 10 '18 at 21:16

1 Answers1

1

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

Miguel
  • 49
  • 1
  • 7