Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Linker error in static build when including qico plugin

    General and Desktop
    2
    2
    1714
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cenarius2 last edited by

      I followed the guides about including qico plugin to static build but I keep getting linker error. I tried at least 10 different variants.

      .pro
      @CONFIG += static
      static {
      QTPLUGIN += qico
      DEFINES += STATIC
      message("Static build")
      }@

      main.cpp
      @#include "mainwindow.h"
      #include <QApplication>

      #ifdef STATIC
      #include <QtPlugin>
      Q_IMPORT_PLUGIN(qico)
      #endif

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();

      return a.exec&#40;&#41;;
      

      }@

      Also tried this variant
      .pro
      @CONFIG += static
      QTPLUGIN += qico@

      main.cpp
      @#include "mainwindow.h"
      #include <QApplication>

      #include <QtPlugin>
      Q_IMPORT_PLUGIN(qico)

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();

      return a.exec&#40;&#41;;
      

      }@

      Always results in linker error:
      @main.obj:-1: error: LNK2019: unresolved external symbol "struct QStaticPlugin const __cdecl qt_static_plugin_qico(void)" (?qt_static_plugin_qico@@YA?BUQStaticPlugin@@XZ) referenced in function "public: __thiscall StaticqicoPluginInstance::StaticqicoPluginInstance(void)" (??0StaticqicoPluginInstance@@QAE@XZ)@

      I also tried to manually add qico.lib to LIBS but no success.

      Platform: Windows 7
      Qt static build with:
      @configure -static -release -qmake -opensource -nomake examples -nomake tests -opengl desktop -platform win32-msvc2010
      jom@
      Then added the static build to Kits and under Projects added as build option for my project. So, building with Qt 5.2 Desktop Static Build msvc2010 win32 release.

      The linker error seems so obscure that I can't find anything with google or stackoverflow. This forum is my last resort. :|

      1 Reply Last reply Reply Quote 0
      • K
        kroman last edited by

        Try this:
        ...
        Q_IMPORT_PLUGIN (QICOPlugin);
        ...

        1 Reply Last reply Reply Quote 0
        • First post
          Last post