报错内容
Error 3 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) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qaccessible_win.obj) spreadsheet (chap04\spreadsheet)
Error 4 error LNK2019: unresolved external symbol _ImmSetCandidateWindow@8 referenced in function "public: virtual void __thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 5 error LNK2019: unresolved external symbol _ImmSetCompositionWindow@8 referenced in function "public: virtual void __thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 6 error LNK2019: unresolved external symbol _ImmSetCompositionFontW@8 referenced in function "public: virtual void __thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 7 error LNK2019: unresolved external symbol _ImmGetContext@4 referenced in function "struct HIMC__ * __cdecl getContext(struct HWND__ *)" (?getContext@@YAPAUHIMC__@@PAUHWND__@@@Z) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 8 error LNK2019: unresolved external symbol _ImmReleaseContext@8 referenced in function "void __cdecl releaseContext(struct HWND__ *,struct HIMC__ *)" (?releaseContext@@YAXPAUHWND__@@PAUHIMC__@@@Z) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 9 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) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 10 error LNK2019: unresolved external symbol _ImmGetCompositionStringW@16 referenced in function "long __cdecl getCompositionString(struct HIMC__ *,unsigned long,void *,unsigned long)" (?getCompositionString@@YAJPAUHIMC__@@KPAXK@Z) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 11 error LNK2019: unresolved external symbol _ImmAssociateContext@8 referenced in function "void __cdecl enableIme(class QWidget *,bool)" (?enableIme@@YAXPAVQWidget@@_N@Z) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 12 error LNK2019: unresolved external symbol _ImmGetDefaultIMEWnd@4 referenced in function "struct HWND__ * __cdecl getDefaultIMEWnd(struct HWND__ *)" (?getDefaultIMEWnd@@YAPAUHWND__@@PAU1@@Z) D:\rCode\qt-book\chap04\spreadsheet\QtGuid.lib(qwininputcontext_win.obj) spreadsheet (chap04\spreadsheet)
Error 13 error LNK2019: unresolved external symbol _WSAAsyncSelect@16 referenced in function "public: void __thiscall QEventDispatcherWin32Private::doWsaAsyncSelect(int)" (?doWsaAsyncSelect@QEventDispatcherWin32Private@@QAEXH@Z) D:\rCode\qt-book\chap04\spreadsheet\QtCored.lib(qeventdispatcher_win.obj) spreadsheet (chap04\spreadsheet)
Error 14 error LNK1120: 11 unresolved externals D:\rCode\qt-book\chap04\spreadsheet\debug\\spreadsheet.exe spreadsheet (chap04\spreadsheet)
解决方案
加入lib库:Imm32.lib
、Winmm.lib
、ws2_32.lib
参考链接
https://forum.qt.io/topic/13669/getting-unresolved-externals-with-static-version-4-8-0/3