2010-03-27 100 views
5

我試圖用MS VS 2008靜態編譯Qt + Webkit,並且這個工作正常。靜態編譯QWebKit 4.6.2

1> Creating library C:\Users\Geeko\Desktop\Qt\TestQ\Release\TestQ.lib and object C:\Users\Geeko\Desktop\Qt\TestQ\Release\TestQ.exp 
1>QtWebKit.lib(PluginPackageWin.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "class WebCore::String __cdecl WebCore::getVersionInfo(void * const,class WebCore::String const &)" ([email protected]@@[email protected]@[email protected]@Z) 
1>QtWebKit.lib(PluginPackageWin.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "private: bool __thiscall WebCore::PluginPackage::fetchInfo(void)" ([email protected]@[email protected]@AAE_NXZ) 
1>QtWebKit.lib(PluginPackageWin.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "private: bool __thiscall WebCore::PluginPackage::fetchInfo(void)" ([email protected]@[email protected]@AAE_NXZ) 
1>QtWebKit.lib(PluginDatabaseWin.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "class WebCore::String __cdecl WebCore::safariPluginsDirectory(void)" ([email protected]@@[email protected]@XZ) 
1>QtWebKit.lib(PluginDatabaseWin.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl WebCore::addWindowsMediaPlayerPluginDirectory(class WTF::Vector &)" ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>QtWebKit.lib(PluginDatabaseWin.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl WebCore::addMacromediaPluginDirectories(class WTF::Vector &)" ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>C:\Users\Geeko\Desktop\Qt\TestQ\Release\TestQ.exe : fatal error LNK1120: 6 unresolved externals 

我需要在Qt工程選項檢查一番:

C:\Qt\4.6.2>configure -release -static -opensource -no-fast -no-exceptions -no-accessibility -no-rtti -no-stl -no-opengl -no-openvg -no-incredibuild-xge -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -no-style-windowsce -no-style-windowsmobile -no-style-s60 -no-gif -no-libpng -no-libtiff -no-libjpeg -no-libmng -no-qt3support -no-mmx -no-3dnow -no-sse -no-sse2 -no-iwmmxt -no-openssl -no-dbus -platform win32-msvc2008 -arch windows -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-script -no-scripttools -webkit -no-declarative 

但是,我只要構建靜態鏈接到QWebKit項目得到這些錯誤?我有QtCore,QtGui,網絡和WebKit檢查。

+0

來吧!沒有答案也沒有評論! – geeko 2010-03-28 10:35:53

+0

配置Qt進行編譯時,是否需要包含多媒體/聲子模塊或gif/jpeg/... etc庫? – geeko 2010-03-29 05:47:48

回答

4

它看起來像你需要在Windows .lib文件鏈接爲每個缺少的功能:

VerQueryValue,GetFileVersionInfo - > version.lib

GetFileVersionInfoSize - > Coredll.lib

PathRemoveFileSpec,SHGetValue,PathCombine - > shlwapi.lib

如果您正在使用的qmake,您可以添加: LIBS + = -lversion -lCoredll -lshlwapi

否則:從項目菜單中選擇屬性。打開配置屬性 - >鏈接器 - >輸入。在Additional Dependencies字段中,添加version.lib,Coredll.lib和shlwapi.lib

+0

其實我只做了version.lib&shlwapi.lib,它工作!雖然,你實際上去了Librarian而不是Linker的配置。但是,有一件事情沒有奏效:圖片/視頻不顯示在網頁控制中! – geeko 2010-04-08 10:15:46

+0

@geeko:這聽起來像Qt不加載插件。由於您正在靜態編譯Qt,因此您需要執行一些額外的步驟才能使靜態插件正常工作。查看靜態插件上的Qt文檔: http://qt.nokia.com/doc/4.6/plugins-howto.html#static-plugins – 2010-04-08 17:14:50

+0

我實際上使用MSVC2008,所以有沒有辦法通過.pro檔案? – geeko 2010-04-09 19:02:45