JCh3ss
JCh3ss

Reputation: 43

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. 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. 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)"

As this didn't work out, I installed qt 5.5.0 mingw492_32 with the installer. Using that I was able to create a new project with the QTCreator. It compiled in the 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.

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. Yet, the mkspecs-folder is still empty. Creating a Qt-Widget-application with the Qt Creator endts up in a crashing app (no changes were made to the default code):

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:

Concerning the mkspecs: Turns out I had to call both:

jom -j 8
jom install

Now all mkspecs are created. 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. 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.

Upvotes: 2

Views: 11059

Answers (2)

the_mandrill
the_mandrill

Reputation: 30862

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. 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')

  • Clone the qt5 repository or unzip the source
  • Start a command prompt. IMPORTANT: create the correct 'VS2015 x86 or x64' prompt
  • DON'T edit the msvc-desktop.conf as mentioned in the Walkthrough. (Qt can't be built with the /MT flag)
  • Run configure:

    configure -debug-and-release -opensource -platform win32-msvc2015 -opengl desktop -nomake examples -nomake tests

  • Build with jom -j 8 (I find you get diminishing returns beyond that) or nmake. If you omit the examples and tests I can build the whole of qtbase in about 10-15 minutes

  • Run jom install or nmake install

Upvotes: 1

Acha Bill
Acha Bill

Reputation: 1255

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++.

You might want to uninstall all previous Qt.

Upvotes: 1

Related Questions