Qt (Static Build) Unresolved Externals (MSVC2017)



  • After a day or so I've finally gotten a (or what should be) statically compiled Qt Library. I have downloaded the single zip file src that is on the /download page. ave ran configure.bat and jom, yet when I try to make a stand-alone application I run into 171 Unresolved externals from the following libraries

    Qt5Gui.lib
    Qt5Core.lib
    Qt5Widgets.lib
    qwindows.lib
    

    I have googled for around 40 minutes to an hour now with no solution found. I found many posts with similar issues on SO and Qt Forum which say "Oh I included this and that and it works!", but I have included/linked all I have found (and much more) in hoped for a fix with nothing working.

    TL;DR Libs listed above are giving out unresolved externals and I've no idea why.
    All linked libraries:

    /kernel32.lib
    user32.lib
    shell32.lib
    uuid.lib
    ole32.lib
    advapi32.lib
    ws2_32.lib
    gdi32.lib
    comdlg32.lib
    oleaut32.lib
    imm32.lib
    winmm.lib
    qtmain.lib
    opengl32.lib
    qwindows.lib
    Qt5PlatformCompositorSupport.lib
    d3d9.lib
    qtfreetype.lib
    Qt5Core.lib
    Qt5Gui.lib
    Qt5Widgets.lib
    

    All includes (across all files)

    #include <QtGui\qwindow.h>
    #include <QtWidgets/QMainWindow>
    #include "ui_statictest.h"
    #include "statictest.h"
    #include <QtPlugin>
    #include <QtWidgets/QApplication>
    

    Compiling with MSVC 2017 for Release build x86



  • I'm not an expert in this area. But just as a heads-up before others try to help you: it might help if you gave a few examples (from your 171) of precisely what symbols are reported unresolved, so that someone could perhaps identify a missing library.



  • Good point.
    First error for each different lib:

    Severity	Code	Description	Project	File	Line	Suppression State Error	LNK2019	unresolved external symbol _GetFileVersionInfoSizeW@8 referenced in function "public: class QString __thiscall QCoreApplicationPrivate::appVersion(void)const " (?appVersion@QCoreApplicationPrivate@@QBE?AVQString@@XZ)	statictest	C:\Users\Justin\Documents\Visual Studio 2017\Projects\statictest\statictest\Qt5Core.lib(qcoreapplication_win.obj)	1	
    
    Severity	Code	Description	Project	File	Line	Suppression State
    Error	LNK2019	unresolved external symbol _GetFileVersionInfoSizeW@8 referenced in function "public: class QString __thiscall QCoreApplicationPrivate::appVersion(void)const " (?appVersion@QCoreApplicationPrivate@@QBE?AVQString@@XZ)	statictest	C:\Users\Justin\Documents\Visual Studio 2017\Projects\statictest\statictest\Qt5Core.lib(qcoreapplication_win.obj)	1	
    
    
    Severity	Code	Description	Project	File	Line	Suppression State
    Error	LNK2019	unresolved external symbol __imp__GetThemeColor@20 referenced in function "public: bool __thiscall QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(class XPThemeData &,double)" (?drawBackgroundThruNativeBuffer@QWindowsXPStylePrivate@@QAE_NAAVXPThemeData@@N@Z)	statictest	C:\Users\Justin\Documents\Visual Studio 2017\Projects\statictest\statictest\Qt5Widgets.lib(qwindowsxpstyle.obj)	1	
    
    
    Severity	Code	Description	Project	File	Line	Suppression State
    Error	LNK2019	unresolved external symbol "class QStringList __cdecl QAccessibleBridgeUtils::effectiveActionNames(class QAccessibleInterface *)" (?effectiveActionNames@QAccessibleBridgeUtils@@YA?AVQStringList@@PAVQAccessibleInterface@@@Z) referenced in function "public: virtual long __stdcall QWindowsIA2Accessible::doAction(long)" (?doAction@QWindowsIA2Accessible@@UAGJJ@Z)	statictest	C:\Users\Justin\Documents\Visual Studio 2017\Projects\statictest\statictest\qwindows.lib(iaccessible2.obj)	1	
    
    
    

    All errors:
    https://hastebin.com/ilahojenut.tex



  • So, for example, just taking the unresolved __imp__GetThemePartSize@28, I see in your output, https://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(GetThemePartSize);k(DevLang-C);k(TargetOS-WINDOWS)&rd=true states you will need static library UxTheme.lib, which I don't see among your libraries?

    Also I note that says that is for "desktop apps only", since you're linking statically I don't know if there is a compiler/linker option you might need to pass to indicate that....



  • I'll take a look at the UxTheme lib now. As for the compiler/linker option tos I've already done that.
    //edit
    You were right! Including that lib has taken the 171 unresolved externals to 154
    Going further down the list of errors and including libs of the functions on MSDN is now only decreasing by 0-2 errors per lib.



  • An unresolved was _pcre2_config_16.

    So I'm doing your Googling for you ;-)
    https://doc.qt.io/qt-5/qtcore-attribution-pcre2.html
    http://www.regular-expressions.info/pcre2.html
    Search for maybe pcre2 windows binary

    Does that _16 indicates it's 16-bit....?? Good luck :)

    _hb_buffer stuff? See https://stackoverflow.com/questions/41765673/static-linking-against-qt-on-windows-using-cmake



  • pcre2 was not in the path Qt docs said it was (Might be the issue) as for the HB errors does this mean they're unfixable? Checking the SO you linked the bug report is still unresolved.


Log in to reply
 

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