Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

error linking using static qt and msvc



  • Hallo,
    I have a problem when linking an executable. It seems that the list of file .lib to be linkend is treated as unknown parameters:

    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\prova.exe @C:\Users\max\AppData\Local\Temp\prova.exe.1508.344.jom
    LINK : warning LNK4044: unrecognized option '/Qt/Qt5-static/lib\Qt5PlatformSupport.lib'; ignored
    LINK : warning LNK4044: unrecognized option '/Qt/Qt5-static/lib\qtfreetype.lib'; ignored
    LINK : warning LNK4044: unrecognized option '/Qt/Qt5-static/lib\Qt5Gui.lib'; ignored
    [...]
    Qt5Gui.lib(qtextengine.obj) : error LNK2019: unresolved external symbol _hb_buffer_create referenced in function "private: int __thiscall QTextEngine::shapeTextWithHarfbuzzNG(struct QScriptItem const &,unsigned short const *,int,class QFontEngine *,class QVector<unsigned int> const &,bool)const " (?shapeTextWithHarfbuzzNG@QTextEngine@@ABEHABUQScriptItem@@PBGHPAVQFontEngine@@ABV?$QVector@I@@_N@Z)
    Qt5Gui.lib(qtextengine.obj) : error LNK2019: unresolved external symbol _hb_buffer_destroy referenced in function "private: int __thiscall QTextEngine::shapeTextWithHarfbuzzNG(struct QScriptItem const &,unsigned short const *,int,class QFontEngine *,class QVector<unsigned int> const &,bool)const " (?shapeTextWithHarfbuzzNG@QTextEngine@@ABEHABUQScriptItem@@PBGHPAVQFontEngine@@ABV?$QVector@I@@_N@Z)
    [...]
    

    I have surely misunderstood some step.
    In a newly installed Windows 7 machen I have install Visual Studio 15 Community edition, perl, python and msysgit.
    Then I have cloned qt5, and checkout v5.5.1 (also for submodules).
    I opened a cmd windows and setup the environment with:

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
    

    and then I have configured using:

    configure  -developer-build -opensource -nomake examples -nomake tests -mp -static -prefix "c:\Qt\Qt5-static" 
    

    finally nmake and nmake install, so in c:\Qt\Qt5-static I can find a tree with the static qt library.

    but when I try to build a simple project it fails the linker step.

    I cannot figure out why

    best regards
    Max


  • Lifetime Qt Champion

    @mastupristi "/Qt/Qt5-static/lib\Qt5PlatformSupport.lib" and the others are for sure invalid paths. Can you show your pro file?



  • QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    CONFIG+= static
    
    TARGET = prova
    TEMPLATE = app
    
    SOURCES += main.cpp\
            dialog.cpp
    
    HEADERS  += dialog.h
    
    FORMS    += dialog.ui
    

    I tried with and without CONFIG+= static, but nothing changes.

    I call qmake with this command line:

    c:\Qt\Qt5-static\bin\qmake.exe prova.pro -r -spec win32-msvc2015
    

    best regard
    Max


Log in to reply