如何为Windows构建静态Qt库并将其与Qt Creator结合使用 [英] How to build static Qt libraries for Windows and use them with Qt Creator

查看:105
本文介绍了如何为Windows构建静态Qt库并将其与Qt Creator结合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了以下Qt来源: http://download.qt.nokia .com/qt/source/qt-everywhere-opensource-src-4.7.3.zip 并尝试使用MS VC 2010使用静态库设置发行版.

I've downloaded the following Qt sources: http://download.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.zip and tried to setup a distribution with static libraries using MS VC 2010.

之前,我确实阅读了以下文章:

Beforehand I did read the following articles:

http://www.qtcentre.org/wiki/index.php? title = Building_static_Qt_on_Windows

http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler

我修改了mkspecs \ win32-msvc2010 \ qmake.conf-更新了QMAKE_CFLAGS_RELEASE键以使用MT选项而不是MD. 之后,我从VC 2010命令提示符处执行了以下命令行:

I modified the mkspecs\win32-msvc2010\qmake.conf - update the QMAKE_CFLAGS_RELEASE key to use the MT option instead of MD. After that I executed the following command line from the VC 2010 command prompt:

   configure -platform win32-msvc2010 -static -release

完成后,我被要求简单地运行nmake,我这样做了. 之后,我尝试将静态libs分发文件夹中的qmake添加到Qt Creator(工具/选项-Qt"部分).它不成功-Qt Creator收到未能检测到Qt版本使用的ABI"消息.

When that has finished I was asked to simply run nmake, which I did. After that I tried to add the qmake from the the static libs distribution folder to Qt Creator (Tools/Options - Qt section). It was unsuccessful - got "Failed to detect ABI(s) used by the Qt version" message by Qt Creator.

在运行configure命令之前,我还尝试(在干净的发行版上)修改qmake/Makefile.win32文件-在CFLAGS_BARE定义中添加了/MT选项,但在Qt Creator中得到了相同的错误消息.

I also tried (on a clean distribution) modifying the qmake/Makefile.win32 file before running the configure command - added /MT option to the CFLAGS_BARE definition, but got the same error message in Qt Creator.

我正在使用Qt Creator 2.3. -单独安装.

I'm using Qt Creator 2.3. - installed separately.

我该如何解决这个问题?

How can I solve this problem?

推荐答案

您是否正在使用2.3的稳定版本或Qt Creator的候选版本/Beta版?检查帮助"->关于Qt Creator"以获取该版本.如果是2.x.xx之类的内容,请尝试更新到更高版本的Qt Creator.

Are you using the stable release of 2.3 or a release candidate / beta version of Qt Creator? Check Help->About Qt Creator for the version. If it is something like 2.x.xx try updating to a newer version of Qt Creator.

您描述的问题已列为2.2.0的错误,并已设置为2.3.0的问题:

The issue you described was listed as a bug for 2.2.0 and was set to fixed for 2.3.0:

https://bugreports.qt.io/browse/QTCREATORBUG-4771

如果您已经在使用较新的版本,但仍然存在该问题,我已阅读有关将QtCore4.dll放在.lib文件旁边的内容.然后,Qt Creator将基于该dll找到Qt版本,但无论如何都将使用.libs进行链接.

If you are already using a newer version and still have that issue, I've read something about putting a QtCore4.dll next to the .lib files. Qt Creator will then find the Qt version based on that dll, but will use the .libs for linking anyway.

这篇关于如何为Windows构建静态Qt库并将其与Qt Creator结合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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