使用Visual Studio 2013构建Qt 5.2.1的静态版本 [英] Building A static version of Qt 5.2.1 with Visual Studio 2013

查看:96
本文介绍了使用Visual Studio 2013构建Qt 5.2.1的静态版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了几天,用Visual Studio 2013构建静态版本的Qt. 我只是无法弄清楚我做错了什么.

I have been trying for a few days now to build a static version of Qt with Visual Studio 2013. I just cannot figure out what I did wrong.

系统:

  • Windows 7 64位
  • Visual Studio 2013(仍安装了Visual Studio 2012)
  • 已安装Perl(ActivePerl-5.18.2.1801-MSWin32-x64-297964.msi)
  • 已安装Python(python-2.7.6.amd64.msi)
  • 已安装Direct X 10 SDK(DXSDK_Jun10.exe,我必须使用此解决方法)
  • 下载了 Qt 5.2 .1
  • 已下载
  • Windows 7 64 bit
  • Visual Studio 2013 (Visual Studio 2012 is still installed)
  • Perl is installed (ActivePerl-5.18.2.1801-MSWin32-x64-297964.msi)
  • Python is installed (python-2.7.6.amd64.msi)
  • Direct X 10 SDK is installed (DXSDK_Jun10.exe I had to use this workaround)
  • Downloaded Qt 5.2.1
  • Downloaded Qt 5.3.0 alpha

我多次做了:

  • 在临时文件夹(C:\ QtSrc)中提取源
  • 删除qtwebkit和qtwebkit-examples目录

对于每个文件夹,我启动了Visual Studio x86命令行并运行:

For each folder I launched a Visual Studio x86 command line and ran:

  • cd C:\ QtSrc
  • 配置-c ++ 11 -mp-调试和发布-静态-角度-nomake测试-nomake示例-前缀C:\ Qt \ 5.2.1 \ msvc2013 -platform win32-msvc2013
  • nmake
  • nmake安装

对于我尝试过的-static,-shared或Qt 5.2.1 vs Qt 5.3.0 alpha的每个变体,这始终是成功的.

This was always sucessfull for every variations of -static vs -shared or Qt 5.2.1 vs Qt 5.3.0 alpha that I tried.

在Qt Creator中

我可以注册各种工具包,使用共享的Qt库编译并启动任何示例.另一方面,使用静态Qt库的示例从未编译过. 该错误始终如下所示: LNK1104:无法打开文件'C:/Qt/5.3.0/msvc2013-static/lib/translator_common.lib'. 问题在于文件丢失(在调试模式下为translator_commond.lib或在发布模式下为translator_common.lib)

I can register the various Kits, compile and launch any example using the shared Qt library. The examples using the static Qt library on the other hand never compiled. The error always looks like this: LNK1104: cannot open file 'C:/Qt/5.3.0/msvc2013-static/lib/translator_common.lib'. The problem is that the file is missing (either translator_commond.lib in debug mode or translator_common.lib in release mode)

在Visual Studio 2013中(使用Visual Studio插件1.2.3 alpha)

In Visual Studio 2013 (with Visual Studio Addin 1.2.3 alpha)

我可以添加Qt版本并更改解决方案的Qt版本. 如果可以使用共享版本的Qt编译并运行这样一个非常简单的程序:

I can add the Qt version and change the Qt version of my solution. If can compile and run a very simple program like this one using the shared version of Qt:

#include <QtCore>
#include <QtGui>
#include <QtWidgets>

Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);

int main(int argc,char*argv[]){
    QApplication app(argc,argv);
    QMessageBox::critical(nullptr,"Hello","Hello Qt!");
    return 0;}

使用静态版本的Qt时出现未解决的外部链接器错误:

I get unresolved external linker errors when using the static version of Qt:

1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShInitialize referenced in function "private: void __thiscall gl::Shader::initializeCompiler(void)" (?initializeCompiler@Shader@gl@@AAEXXZ)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShFinalize referenced in function "public: static void __cdecl gl::Shader::releaseCompiler(void)" (?releaseCompiler@Shader@gl@@SAXXZ)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShInitBuiltInResources referenced in function "private: void __thiscall gl::Shader::initializeCompiler(void)" (?initializeCompiler@Shader@gl@@AAEXXZ)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShConstructCompiler referenced in function "private: void __thiscall gl::Shader::initializeCompiler(void)" (?initializeCompiler@Shader@gl@@AAEXXZ)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShDestruct referenced in function "public: static void __cdecl gl::Shader::releaseCompiler(void)" (?releaseCompiler@Shader@gl@@SAXXZ)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShCompile referenced in function "protected: void __thiscall gl::Shader::compileToHLSL(void *)" (?compileToHLSL@Shader@gl@@IAEXPAX@Z)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShGetInfo referenced in function "protected: void __thiscall gl::Shader::compileToHLSL(void *)" (?compileToHLSL@Shader@gl@@IAEXPAX@Z)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShGetInfoLog referenced in function "protected: void __thiscall gl::Shader::compileToHLSL(void *)" (?compileToHLSL@Shader@gl@@IAEXPAX@Z)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShGetObjectCode referenced in function "protected: void __thiscall gl::Shader::compileToHLSL(void *)" (?compileToHLSL@Shader@gl@@IAEXPAX@Z)
1>libGLESv2d.lib(Shader.obj) : error LNK2019: unresolved external symbol _ShGetInfoPointer referenced in function "protected: void __thiscall gl::Shader::compileToHLSL(void *)" (?compileToHLSL@Shader@gl@@IAEXPAX@Z)

尽管进行了所有努力,但我仍然找不到要解决这些缺失符号的库.

Despite all my efforts I was unable to find which lib to include to resolve those missing symbols.

您知道我做错了什么吗?

推荐答案

使用-angle和-static时,make install中存在一个错误.

您可以找到错误报告此处.

一个简单的解决方法是在构建过程结束时添加一些副本:

A simple workaround is to add a few copy at the end of the build process:

copy qtbase\lib\translator_common.lib C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\translator_common.prl C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\translator_commond.lib C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\translator_commond.prl C:\Qt\5.3.0\msvc2013-static\lib\

copy qtbase\lib\translator_hlsl.lib C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\translator_hlsl.prl C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\translator_hlsld.lib C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\translator_hlsld.prl C:\Qt\5.3.0\msvc2013-static\lib\

copy qtbase\lib\preprocessor.lib C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\preprocessor.prl C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\preprocessord.lib C:\Qt\5.3.0\msvc2013-static\lib\
copy qtbase\lib\preprocessord.prl C:\Qt\5.3.0\msvc2013-static\lib\

我希望这可以帮助其他人.

I hope this can help others.

这篇关于使用Visual Studio 2013构建Qt 5.2.1的静态版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆