Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linker error in static build when including qico plugin

Linker error in static build when including qico plugin

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.8k Views
  • 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 Offline
    C Offline
    cenarius2
    wrote on last edited by
    #1

    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
    0
    • K Offline
      K Offline
      kroman
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved