Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-43636

Qt 5.4 static build produces “unresolved external symbol” link error in Visual Studio 2013

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 5.4.0
    • Build System, Documentation
    • None
    • Windows 7 x64
      Visual Studio 2013 Ultimate Update 4
      Qt5 Visual Studio Add-in 1.2.4
      ActivePerl / ActivePython

    Description

      I want to use a static build of Qt 5.4, so I downloaded the source code (qt-everywhere-opensource-src-5.4.0.zip) and followed the instructions posted at http://doc.qt.io/qt-5/windows-building.html

      My configuration command:

      configure \
      -c++11 \
      -mp \
      -release \
      -static \
      -nomake tests \
      -nomake examples \
      -prefix D:\Qt\qt-5.4.0-x86-msvc2013-compact-static \
      -platform win32-msvc2013 \
      -opengl desktop \
      -no-icu \
      -skip webkit

      Next I ran nmake and nmake install

      All this run through without errors.

      Then in Visual Studio, I changed the Qt version of an existing Qt project to D:\Qt\qt-5.4.0-x86-msvc2013-compact-static as this was the output folder of the above procedure.

      However, now I get tons of unresolved external symbol errors of the following kind (build configuration "release"):

      error LNK2001: unresolved external symbol "__imp__glBindTexture@8". Qt5Gui.lib(qopenglfunctions.obj)
      ...
      error LNK2001: unresolved external symbol "_hb_blob_create".    Qt5Gui.lib(qharfbuzzng.obj)
      ...
      error LNK2001: unresolved external symbol "_hb_face_create_for_tables". Qt5Gui.lib(qharfbuzzng.obj)
      

      (I also tried a new project: File -> New > Project... -> Qt Application -> OK -> Exit Qt5 GUI Project Wizard with default settings. Same error messages as before.)

      A shared library / dynamic linking build with similar options (-platform win32-msvc2013 -opengl desktop -no-icu -skip webkit) works just fine.

      There is a similar question on stackoverflow (http://stackoverflow.com/questions/27759754/) where someone suggested me to create a bug report.

      Update Jan 6th:
      1) I found a bug which is probably related: QTBUG-38913
      2) I found out that you can reduce the number of error messages if you add those two libraries to your additional dependencies in Visual Studio: opengl32.lib and Ws2_32.lib
      3) I updated the attached error list, so that the (remaining) error messages provide more information. Hope this helps.

      Update Jan 7th:
      I found the missing library: qtharfbuzzng.lib
      Now I am able to compile without errors.
      However, there was nearly no documentation on how to link against a static build. So please fix either Qt, so that a static build works out of the box, or the Visual Studio add-in, so that it adds the missing dependencies when selected a static build, or fix your documentation so that it's clear to everyone which libraries have to be added.

      Bonus: There was even more trouble with the static Qt build. See my answer on stackoverlow.

      Attachments

        1. errorlist_new.txt
          15 kB
        2. errorlist.txt
          20 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            docteam Qt Documentation Team
            madock manuel
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes