Qt5.13.0靜態編譯

所用到的庫,都上傳到了github

https://github.com/nangongyuan/Qt-5.13.0-.git

 

所需包含的頭文件,這裏直接用了絕對路徑,實際使用中最好不要

E:\Qt\Qt5.13.0\5.13.0\Src\qtbase\include\QtCore
E:\Qt\Qt5.13.0\5.13.0\Src\qtbase\include\QtGui
E:\Qt\Qt5.13.0\5.13.0\Src\qtbase\include\QtWidgets
E:\Qt\Qt5.13.0\5.13.0\Src\qtbase\include\

運行庫改成MTD,Release就是MT,依賴靜態運行庫

 

附加庫目錄

E:\Qt\Qt5.13.0\5.13.0\Src\qtbase\lib
E:\Qt\Qt5.13.0\5.13.0\Src\qtbase\plugins\platforms

 

附加依賴項

qtmaind.lib
Qt5Cored.lib
Qt5Guid.lib
Qt5Widgetsd.lib
Qt5ThemeSupportd.lib
Qt5WindowsUIAutomationSupportd.lib
Qt5FontDatabaseSupportd.lib
Qt5EventDispatcherSupportd.lib
qtlibpngd.lib
qminimald.lib
qwindowsd.lib
qtpcre2d.lib
qtfreetyped.lib
qtharfbuzzd.lib
winmm.lib
glu32.lib
gdi32.lib
kernel32.lib
user32.lib
shell32.lib
uuid.lib
ole32.lib
advapi32.lib
mpr.lib
version.lib
Netapi32.lib
Userenv.lib
Dwmapi.lib
Wtsapi32.lib
ws2_32.lib
imm32.lib

 

main.cpp中加上

#include <QtPlugin>
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)

即可依賴QT靜態庫

 

遇到的一些問題

1>qwindowsd.lib(qwindowscontext.obj) : error LNK2019: 無法解析的外部符號 _WTSQuerySessionInformationW@20,該符號在函數 "public: static bool __cdecl QWindowsContext::isSessionLocked(void)" (?isSessionLocked@QWindowsContext@@SA_NXZ) 中被引用
1>qwindowsd.lib(qwindowscontext.obj) : error LNK2019: 無法解析的外部符號 _WTSFreeMemory@4,該符號在函數 "public: static bool __cdecl QWindowsContext::isSessionLocked(void)" (?isSessionLocked@QWindowsContext@@SA_NXZ) 中被引用
1>G:\C++ Demo\TestMT\TestMT\Debug\ConsoleApplication1.exe : fatal error LNK1120: 2 個無法解析的外部命令

_WTSQuerySessionInformationW

_WTSFreeMemory

查詢可以發現,這2個函數在Wtsapi32中,在依賴項中加入Wtsapi32.lib中即可解決

 

1>qwindowsd.lib(qwindowswindow.obj) : error LNK2019: 無法解析的外部符號 __imp__DwmEnableBlurBehindWindow@8,該符號在函數 "bool __cdecl applyBlurBehindWindow(struct HWND__ *)" (?applyBlurBehindWindow@@YA_NPAUHWND__@@@Z) 中被引用
1>qwindowsd.lib(qwindowswindow.obj) : error LNK2019: 無法解析的外部符號 __imp__DwmIsCompositionEnabled@4,該符號在函數 "bool __cdecl applyBlurBehindWindow(struct HWND__ *)" (?applyBlurBehindWindow@@YA_NPAUHWND__@@@Z) 中被引用
1>G:\C++ Demo\TestMT\TestMT\Debug\ConsoleApplication1.exe : fatal error LNK1120: 2 個無法解析的外部命令

DwmEnableBlurBehindWindow

DwmIsCompositionEnabled

這2個函數在Dwmapi.中,缺少Dwmapi.lib

 

1>Qt5Cored.lib(qfilesystemengine_win.obj) : error LNK2019: 無法解析的外部符號 __imp__GetUserProfileDirectoryW@12,該符號在函數 "public: static class QString __cdecl QFileSystemEngine::homePath(void)" (?homePath@QFileSystemEngine@@SA?AVQString@@XZ) 中被引用
1>G:\C++ Demo\TestMT\TestMT\Debug\ConsoleApplication1.exe : fatal error LNK1120: 1 個無法解析的外部命令

__imp__GetUserProfileDirectoryW

在Userenv中,依賴項中添加Userenv.lib

 

1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_config_16,該符號在函數 "public: void __thiscall QRegularExpressionPrivate::getPatternInfo(void)" (?getPatternInfo@QRegularExpressionPrivate@@QAEXXZ) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_match_context_create_16,該符號在函數 "public: struct QRegularExpressionMatchPrivate * __thiscall QRegularExpressionPrivate::doMatch(class QString const &,int,int,int,enum QRegularExpression::MatchType,class QFlags<enum QRegularExpression::MatchOption>,enum QRegularExpressionPrivate::CheckSubjectStringOption,struct QRegularExpressionMatchPrivate const *)const " (?doMatch@QRegularExpressionPrivate@@QBEPAUQRegularExpressionMatchPrivate@@ABVQString@@HHHW4MatchType@QRegularExpression@@V?$QFlags@W4MatchOption@QRegularExpression@@@@W4CheckSubjectStringOption@1@PBU2@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_match_context_free_16,該符號在函數 "public: struct QRegularExpressionMatchPrivate * __thiscall QRegularExpressionPrivate::doMatch(class QString const &,int,int,int,enum QRegularExpression::MatchType,class QFlags<enum QRegularExpression::MatchOption>,enum QRegularExpressionPrivate::CheckSubjectStringOption,struct QRegularExpressionMatchPrivate const *)const " (?doMatch@QRegularExpressionPrivate@@QBEPAUQRegularExpressionMatchPrivate@@ABVQString@@HHHW4MatchType@QRegularExpression@@V?$QFlags@W4MatchOption@QRegularExpression@@@@W4CheckSubjectStringOption@1@PBU2@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_compile_16,該符號在函數 "public: void __thiscall QRegularExpressionPrivate::compilePattern(void)" (?compilePattern@QRegularExpressionPrivate@@QAEXXZ) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_code_free_16,該符號在函數 "public: void __thiscall QRegularExpressionPrivate::cleanCompiledPattern(void)" (?cleanCompiledPattern@QRegularExpressionPrivate@@QAEXXZ) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_pattern_info_16,該符號在函數 "public: class QStringList __thiscall QRegularExpression::namedCaptureGroups(void)const " (?namedCaptureGroups@QRegularExpression@@QBE?AVQStringList@@XZ) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_match_data_create_from_pattern_16,該符號在函數 "public: struct QRegularExpressionMatchPrivate * __thiscall QRegularExpressionPrivate::doMatch(class QString const &,int,int,int,enum QRegularExpression::MatchType,class QFlags<enum QRegularExpression::MatchOption>,enum QRegularExpressionPrivate::CheckSubjectStringOption,struct QRegularExpressionMatchPrivate const *)const " (?doMatch@QRegularExpressionPrivate@@QBEPAUQRegularExpressionMatchPrivate@@ABVQString@@HHHW4MatchType@QRegularExpression@@V?$QFlags@W4MatchOption@QRegularExpression@@@@W4CheckSubjectStringOption@1@PBU2@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_match_16,該符號在函數 "int __cdecl safe_pcre2_match_16(struct pcre2_real_code_16 const *,unsigned short const *,int,int,int,struct pcre2_real_match_data_16 *,struct pcre2_real_match_context_16 *)" (?safe_pcre2_match_16@@YAHPBUpcre2_real_code_16@@PBGHHHPAUpcre2_real_match_data_16@@PAUpcre2_real_match_context_16@@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_match_data_free_16,該符號在函數 "public: struct QRegularExpressionMatchPrivate * __thiscall QRegularExpressionPrivate::doMatch(class QString const &,int,int,int,enum QRegularExpression::MatchType,class QFlags<enum QRegularExpression::MatchOption>,enum QRegularExpressionPrivate::CheckSubjectStringOption,struct QRegularExpressionMatchPrivate const *)const " (?doMatch@QRegularExpressionPrivate@@QBEPAUQRegularExpressionMatchPrivate@@ABVQString@@HHHW4MatchType@QRegularExpression@@V?$QFlags@W4MatchOption@QRegularExpression@@@@W4CheckSubjectStringOption@1@PBU2@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_get_ovector_pointer_16,該符號在函數 "public: struct QRegularExpressionMatchPrivate * __thiscall QRegularExpressionPrivate::doMatch(class QString const &,int,int,int,enum QRegularExpression::MatchType,class QFlags<enum QRegularExpression::MatchOption>,enum QRegularExpressionPrivate::CheckSubjectStringOption,struct QRegularExpressionMatchPrivate const *)const " (?doMatch@QRegularExpressionPrivate@@QBEPAUQRegularExpressionMatchPrivate@@ABVQString@@HHHW4MatchType@QRegularExpression@@V?$QFlags@W4MatchOption@QRegularExpression@@@@W4CheckSubjectStringOption@1@PBU2@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_substring_number_from_name_16,該符號在函數 "public: int __thiscall QRegularExpressionPrivate::captureIndexForName(class QStringView)const " (?captureIndexForName@QRegularExpressionPrivate@@QBEHVQStringView@@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_jit_compile_16,該符號在函數 "public: void __thiscall QRegularExpressionPrivate::optimizePattern(void)" (?optimizePattern@QRegularExpressionPrivate@@QAEXXZ) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_jit_stack_create_16,該符號在函數 "public: __thiscall QPcreJitStackPointer::QPcreJitStackPointer(void)" (??0QPcreJitStackPointer@@QAE@XZ) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_jit_stack_assign_16,該符號在函數 "public: struct QRegularExpressionMatchPrivate * __thiscall QRegularExpressionPrivate::doMatch(class QString const &,int,int,int,enum QRegularExpression::MatchType,class QFlags<enum QRegularExpression::MatchOption>,enum QRegularExpressionPrivate::CheckSubjectStringOption,struct QRegularExpressionMatchPrivate const *)const " (?doMatch@QRegularExpressionPrivate@@QBEPAUQRegularExpressionMatchPrivate@@ABVQString@@HHHW4MatchType@QRegularExpression@@V?$QFlags@W4MatchOption@QRegularExpression@@@@W4CheckSubjectStringOption@1@PBU2@@Z) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_jit_stack_free_16,該符號在函數 "public: __thiscall QPcreJitStackPointer::~QPcreJitStackPointer(void)" (??1QPcreJitStackPointer@@QAE@XZ) 中被引用
1>Qt5Cored.lib(qregularexpression.obj) : error LNK2019: 無法解析的外部符號 _pcre2_get_error_message_16,該符號在函數 "public: class QString __thiscall QRegularExpression::errorString(void)const " (?errorString@QRegularExpression@@QBE?AVQString@@XZ) 中被引用
1>G:\C++ Demo\TestMT\TestMT\Debug\ConsoleApplication1.exe : fatal error LNK1120: 16 個無法解析的外部命令

_pcre2_config_16

_pcre2_match_context_create_16

_pcre2_jit_compile_16

根據名字猜測,這些函數在qtpcre2d.lib中

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章