[英]Building QT for msvc2015 - and get working projects?
There already is a quite related question (rq) here, but it is not specialized enough and my reputation is not high enough to ask for more advice in the comments ... yet, time is running and I've got to get somewhere.这里已经有一个非常相关的问题 (rq) ,但它不够专业,而且我的声誉不够高,无法在评论中寻求更多建议......然而,时间在流逝,我必须有所作为。 Once the original question is answered, this one can and should be deleted.一旦原始问题得到回答,这个问题就可以而且应该被删除。
What I want: Working in Visual Studio 2015, using the qt-library.我想要什么:在 Visual Studio 2015 中工作,使用 qt-library。 That's it.就是这样。
What I did:我做了什么:
The first error: The building-process didn't create any mkspecs, so i wasn't able to set the directory in the QT-options in visual studio: "This QT version uses an unsupported makefile generator (used:, supported: MSVN.NET, MSBUILD)"第一个错误:构建过程没有创建任何 mkspecs,所以我无法在 Visual Studio 的 QT 选项中设置目录:“这个 QT 版本使用了不受支持的 makefile 生成器(使用:,支持:MSVN .NET、MSBUILD)”
As this didn't work out, I installed qt 5.5.0 mingw492_32 with the installer.由于这不起作用,我使用安装程序安装了 qt 5.5.0 mingw492_32。 Using that I was able to create a new project with the QTCreator.使用它,我能够使用 QTCreator 创建一个新项目。 It compiled in the QTCreator.它在 QTCreator 中编译。 After that I executed之后我执行了
qmake -platform win32-msvc2015 -tp vs
to convert the project into a Visual-Studio-project, while qmake was the executable from the previously BUILT version, not the installed one, the include-files where still not found in visual studio.将项目转换为 Visual-Studio 项目,而 qmake 是先前 BUILT 版本的可执行文件,而不是已安装的版本,包含文件在 Visual Studio 中仍未找到。
What am I doing wrong?我究竟做错了什么? The library-directories, the include-directories and the additional-dependencies look fine to me in the converted project.在转换后的项目中,库目录、包含目录和附加依赖项在我看来很好。
EDIT 1: I followed the walkthrough and everything built successfully.编辑 1:我遵循了演练,一切都成功构建。 Yet, the mkspecs-folder is still empty.然而,mkspecs 文件夹仍然是空的。 Creating a Qt-Widget-application with the Qt Creator endts up in a crashing app (no changes were made to the default code):使用 Qt Creator 创建 Qt-Widget 应用程序最终导致应用程序崩溃(未对默认代码进行任何更改):
Second Chance Assertion Failed: File minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp, Line 980
Calling打电话
qmake -platform win32-msvc2015 -tp vs
also isn't successfull:也没有成功:
qmake -platform win32-msvc2015 -tp vs
WARNING: Unable to generate output for: D:/_Daten/_Studium/Bachelor-Thesis/Visual-Studio/VISAR-FSA/GuiTest/Makefile.Debug [TEMPLATE vsapp]
WARNING: Unable to generate output for: D:/_Daten/_Studium/Bachelor-Thesis/Visual-Studio/VISAR-FSA/GuiTest/Makefile.Release [TEMPLATE vsapp]
EDIT 2:编辑2:
Concerning the mkspecs: Turns out I had to call both:关于 mkspecs:原来我不得不打电话给两个:
jom -j 8
jom install
Now all mkspecs are created.现在所有 mkspec 都已创建。 The official documentation made me think that the second one only was an option for the build when a destination path was set.官方文档让我认为第二个只是在设置目标路径时构建的一个选项。 Yet, a freshly created Qt Widget Application in Qt Creator, with the built and installed QT-version and the correct compiler, still won't compile.然而,在 Qt Creator 中新创建的 Qt Widget 应用程序,带有构建和安装的 QT 版本和正确的编译器,仍然无法编译。 A LNK2019 occures in [qtmain.lib(qtmain_win.obj)], telling me that there is a link to a symbol "__imp__CommandLineToArgvW@8" in function "_WinMain@16", that was not resolved. [qtmain.lib(qtmain_win.obj)] 中出现 LNK2019,告诉我在函数“_WinMain@16”中存在指向符号“__imp__CommandLineToArgvW@8”的链接,该链接未解决。
Here is a complete walkthrough:这是一个完整的演练:
How to compile Qt 5 under Windows or Linux, 32 or 64 bit, static or dynamic on VS2010, VS2012, VS2013 or VS2015 Express or g++ . 如何在 Windows 或 Linux 下编译 Qt 5,32 或 64 位,在 VS2010、VS2012、VS2013 或 VS2015 Express 或 g++ 上静态或动态。
You might want to uninstall all previous Qt.您可能想要卸载所有以前的 Qt。
I have Qt built for VS2015 as well as VS2013 and for 5.50 onwards it shouldn't need anything particularly special to get it to build successfully.我已经为 VS2015 和 VS2013 构建了 Qt,并且对于 5.50 以后的版本,它不需要任何特别的东西就可以成功构建。 I tend to use a cut down version of the Walkthrough that @jafar's mentions (and also closer to the method in the official docs ')我倾向于使用@jafar 提到的演练的精简版(也更接近官方文档中的方法)
msvc-desktop.conf
as mentioned in the Walkthrough.不要像演练中提到的那样编辑msvc-desktop.conf
。 (Qt can't be built with the /MT flag) (Qt 不能用 /MT 标志构建)Run configure:运行配置:
configure -debug-and-release -opensource -platform win32-msvc2015 -opengl desktop -nomake examples -nomake tests配置 -debug-and-release -opensource -platform win32-msvc2015 -opengl desktop -nomake 示例 -nomake 测试
Build with jom -j 8
(I find you get diminishing returns beyond that) or nmake
.使用jom -j 8
(我发现你的收益递减)或nmake
构建。 If you omit the examples and tests I can build the whole of qtbase in about 10-15 minutes如果省略示例和测试,我可以在大约 10-15 分钟内构建整个 qtbase
jom install
or nmake install
运行jom install
或nmake install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.