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

问题描述

我做了以下过程,根据 Visual Studio 版本(社区 2015)进行必要的更改,以获得静态 Qt 构建.

I did the following procedure with the necessary changes according to the Visual Studio version (Community 2015) in order to get a static Qt build.

我根据我的安装配置了 QT5Package 插件并编辑了库/包含路径,但我仍然无法构建我的项目.

I configured the QT5Package plugin according to my installation and edited the library/includes path but I'm still unable to build my project.

这是输出

Qt5Cored.lib(qglobal.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in moc_helloqt.obj
<...>
link warning lnk4098 defaultlib 'libcmtd' conflicts with use of other libs
moc_helloqt.obj : error LNK2001: extern symbol not found "public: static struct QMetaObject const QMainWindow::staticMetaObject" (?staticMetaObject@QMainWindow@@2UQMetaObject@@B)
<...>

推荐答案

通过更改运行时 (MDd->MTd) 并将以下库包含到项目中解决的问题:

Problem solved by changing the runtime (MDd->MTd) and including the following libs to the project :

opengl32.lib
Qt5PlatformSupportd.lib
qwindowsd.lib
qtharfbuzzngd.lib
qtpcred.lib
qtfreetyped.lib

这些是调试版本的库,发布版本的库是:

These are the libs for the debug build, the libs for the release build are :

opengl32.lib
Qt5PlatformSupport.lib
qwindows.lib
qtharfbuzzng.lib
qtpcre.lib
qtfreetype.lib

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

08-07 07:08