[SOLVED] Linker errors at static compiling



  • Hey,

    I finally made it to build and install the Qt 5.3.1 static libraries. But when I try to compile, I get some strange linker errors:

    @
    Qt5Core.lib(Qt5Core.dll):-1: error: LNK2005: "public: __thiscall QString::~QString(void)" (??1QString@@QAE@XZ) allready defined in mainwindow.obj.

    mainwindow.obj:-1: error: LNK2019: Unresolved extern symbol ""public: static struct QArrayData const * const QArrayData::shared_null" (?shared_null@QArrayData@@2QBU1@B)" in Funktion ""public: __thiscall QString::QString(void)" (??0QString@@QAE@XZ)".

    moc_mainwindow.obj:-1: error: LNK2001: Unresolved extern symbol ""public: static struct QMetaObject const QMainWindow::staticMetaObject" (?staticMetaObject@QMainWindow@@2UQMetaObject@@B)".
    @

    Here is my pro-file:

    @
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = projectname
    TEMPLATE = app

    CONFIG += static

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    LIBS += -LC:\statics\lib\ -lQt5Core
    -LC:\statics\lib\ -lQt5Gui
    -LC:\statics\lib\ -lQt5Widgets
    -LC:\statics\lib\ -lqtmain
    -LC:\statics\lib\ -lQt5PlatformSupport \

    INCLUDEPATH += C:\statics\include
    @

    I have no idea how to handle these errors. I looked these errors up on this board, but no one of the solutions helps :s

    I read something about importing a plugin inside the C++ code, but I can't remember what exactly to do, any ideas?

    Thank you,

    VVCephei


  • Lifetime Qt Champion

    Hi,

    Looks like you are trying to use your dynamic Qt and link by hand to your static version.

    You should setup your static Qt and Kit using it in Qt Creator



  • Hey SGaist,

    thank you, works perfect now :)
    Didn't exspect such a simple solution ;D


  • Lifetime Qt Champion

    You're welcome !

    It's not always the hard way ;-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.