Linker error in static build when including qico plugin
-
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)
#endifint main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();return a.exec();
}@
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();
}@
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. :|