Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED] Linker errors at static compiling
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Linker errors at static compiling

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 2.3k Views 1 Watching
  • 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.
  • V Offline
    V Offline
    VVCephei
    wrote on 23 Jul 2014, 03:12 last edited by
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Jul 2014, 07:41 last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VVCephei
        wrote on 23 Jul 2014, 17:18 last edited by
        #3

        Hey SGaist,

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 23 Jul 2014, 20:43 last edited by
          #4

          You're welcome !

          It's not always the hard way ;-)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          1/4

          23 Jul 2014, 03:12

          • Login

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