[solved] Unresolved externals building application with Qt 4.7.4 (static) using MSVS 2010



  • I have a Qt application built using the shared libraries. I now need to use the static libraries.

    After much reading, I've compiled Qt 4.7.4 static libraries following the instructions on "http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/":http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/ and "http://stackoverflow.com/questions/5601950/how-to-build-qt-for-visual-studio-2010":http://stackoverflow.com/questions/5601950/how-to-build-qt-for-visual-studio-2010 using jom. It appeared to complete successfully for the following configuration:

    @-debug-and-release
    -opensource
    -platform win32-msvc2010
    -static
    -no-qt3support
    -no-ltcg
    -no-script
    -no-scripttools
    -no-webkit
    -nomake demos
    -nomake examples
    -qt-zlib
    -qt-gif
    -qt-libpng
    -qt-libmng
    -qt-libtiff
    -qt-libjpeg
    -phonon
    -audio-backend
    -saveconfig static @

    I've come to rebuild my Qt application using MSVS 2010 (and the Qt plugin), but I get the following unresolved externals:

    @1>QtCored.lib(qeventdispatcher_win.obj) : error LNK2019: unresolved external symbol _WSAAsyncSelect@16 referenced in function "public: void __thiscall QEventDispatcherWin32Private::doWsaAsyncSelect(int)" (?doWsaAsyncSelect@QEventDispatcherWin32Private@@QAEXH@Z)
    1>QtGuid.lib(qaccessible_win.obj) : error LNK2019: unresolved external symbol _imp__PlaySoundW@12 referenced in function "public: static void cdecl QAccessible::updateAccessibility(class QObject *,int,enum QAccessible::Event)" (?updateAccessibility@QAccessible@@SAXPAVQObject@@HW4Event@1@@Z)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmSetCandidateWindow@8 referenced in function "public: virtual void thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmSetCompositionWindow@8 referenced in function "public: virtual void thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmSetCompositionFontW@8 referenced in function "public: virtual void thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmGetContext@4 referenced in function "struct HIMC
    * cdecl getContext(struct HWND *)" (?getContext@@YAPAUHIMC
    @@PAUHWND
    @@@Z)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmReleaseContext@8 referenced in function "void cdecl releaseContext(struct HWND *,struct HIMC
    *)" (?releaseContext@@YAXPAUHWND
    @@PAUHIMC
    @@@Z)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmNotifyIME@16 referenced in function "void cdecl notifyIME(struct HIMC *,unsigned long,unsigned long,unsigned long)" (?notifyIME@@YAXPAUHIMC
    @@KKK@Z)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmGetCompositionStringW@16 referenced in function "long cdecl getCompositionString(struct HIMC *,unsigned long,void *,unsigned long)" (?getCompositionString@@YAJPAUHIMC
    @@KPAXK@Z)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmAssociateContext@8 referenced in function "void cdecl enableIme(class QWidget *,bool)" (?enableIme@@YAXPAVQWidget@@N@Z)
    1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol ImmGetDefaultIMEWnd@4 referenced in function "struct HWND
    * cdecl getDefaultIMEWnd(struct HWND *)" (?getDefaultIMEWnd@@YAPAUHWND
    @@PAU1@@Z)
    @

    It looks like I am missing a dependency? If so, which one?

    The VS2010 debug build is set up as follows:

    • @Additional Include Directories: .\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles$(ConfigurationName);$(QTDIR)\include;.;%(AdditionalIncludeDirectories)@

    • @Preprocessor Definitions: UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;QT_STATICPLUGIN;%(PreprocessorDefinitions)@

    • @Additional Library Dependencies: $(QTDIR)\lib;%(AdditionalLibraryDirectories)@

    • @Additional Dependencies: qtmaind.lib;QtCored.lib;QtGuid.lib;%(AdditionalDependencies)@

    Any help would be greatly appreciated.



  • Have identified the missing "Additional Dependencies" as:

    • imm32.lib
    • winmm.lib
    • Ws2_32.lib

    I had previously built the project using shared Qt libraries, and am a little surprised I needed to include these when I changed to using static Qt libraries, but hey ho, adding these dependencies works.


  • Moderators

    welcome to the forum
    Good to know that your problem has been solved. Even so you did not get feedback through this forum.

    Please mark your post with "[solved]" in the subject to help others to identify that the post might provide an answer to their problem.
    You can edit your original post by using the edit link.


Log in to reply
 

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