【问题标题】:Statically compiling QWebKit 4.6.2静态编译 QWebKit 4.6.2
【发布时间】:2010-03-27 10:16:11
【问题描述】:

我尝试使用 MS VS 2008 静态编译 Qt+Webkit,并且成功了。

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 的项目时,我都会遇到这些错误:

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 _VerQueryValueW@16 referenced in function "class WebCore::String __cdecl WebCore::getVersionInfo(void * const,class WebCore::String const &)" (?getVersionInfo@WebCore@@YA?AVString@1@QAXABV21@@Z)
1>QtWebKit.lib(PluginPackageWin.obj) : error LNK2019: unresolved external symbol _GetFileVersionInfoW@16 referenced in function "private: bool __thiscall WebCore::PluginPackage::fetchInfo(void)" (?fetchInfo@PluginPackage@WebCore@@AAE_NXZ)
1>QtWebKit.lib(PluginPackageWin.obj) : error LNK2019: unresolved external symbol _GetFileVersionInfoSizeW@8 referenced in function "private: bool __thiscall WebCore::PluginPackage::fetchInfo(void)" (?fetchInfo@PluginPackage@WebCore@@AAE_NXZ)
1>QtWebKit.lib(PluginDatabaseWin.obj) : error LNK2019: unresolved external symbol _imp_PathRemoveFileSpecW@4 referenced in function "class WebCore::String __cdecl WebCore::safariPluginsDirectory(void)" (?safariPluginsDirectory@WebCore@@YA?AVString@1@XZ)
1>QtWebKit.lib(PluginDatabaseWin.obj) : error LNK2019: unresolved external symbol _imp_SHGetValueW@24 referenced in function "void __cdecl WebCore::addWindowsMediaPlayerPluginDirectory(class WTF::Vector &)" (?addWindowsMediaPlayerPluginDirectory@WebCore@@YAXAAV?$Vector@VString@WebCore@@$0A@@WTF@@@Z)
1>QtWebKit.lib(PluginDatabaseWin.obj) : error LNK2019: unresolved external symbol _imp_PathCombineW@12 referenced in function "void __cdecl WebCore::addMacromediaPluginDirectories(class WTF::Vector &)" (?addMacromediaPluginDirectories@WebCore@@YAXAAV?$Vector@VString@WebCore@@$0A@@WTF@@@Z)
1>C:\Users\Geeko\Desktop\Qt\TestQ\Release\TestQ.exe : fatal error LNK1120: 6 unresolved externals

我需要检查 Qt 项目选项中的某些内容吗?我检查了 QtCore、QtGui、Network 和 WebKit。

【问题讨论】:

  • 大师们加油!没有答案也没有 cmets !!
  • 在配置 Qt 进行编译时是否需要包含多媒体/Phonon 模块或 gif/jpeg/...等库?

标签: qt webkit linker static-libraries static-linking


【解决方案1】:

看起来您需要为每个缺少的函数链接到 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

【讨论】:

  • 实际上我只为 version.lib 和 shlwapi.lib 做了它,它有效!不过,您实际上是使用 Librarian 而不是 Linker 配置。但是,有一件事不起作用:图像/视频没有显示在 Web 控件中?!
  • @geeko:听起来 Qt 没有加载插件。由于您正在静态编译 Qt,因此您需要执行一些额外的步骤才能使静态插件正常工作。请参阅关于静态插件的 Qt 文档:qt.nokia.com/doc/4.6/plugins-howto.html#static-plugins
  • 我实际使用的是MSVC2008,有没有不经过.pro文件的方法?
猜你喜欢
  • 2011-01-28
  • 1970-01-01
  • 2010-11-25
  • 1970-01-01
  • 2012-05-24
  • 1970-01-01
  • 2022-10-05
  • 2014-08-22
  • 2019-08-10
相关资源
最近更新 更多