Setting up Qt5 with Visual Studio 2015

39,634

Solution 1

I just wrote a small article explaining how to compile Qt 5.5.1 (with QtWebkit) with Visual Studio 2015.

I realize this is by no mean a good answer: while it does the job, that article mostly relies on helper Windows batch files you can download from my site. As a consequence, while I don't plan to pull my site or the article itself, other SO users or admins would be in their right to flag this answer as too volatile...

Anyways, until Qt folks offer official pre-built binaries built with Visual Studio 2015, I believe my article saves the day. Hope that helps.

Solution 2

Qt5.6.0 Beta includes a prebuilt image for Visual Studio 2015. However, the Qt Visual Studio add-in is no longer supported. There's an extension called Qt5Package you can install instead.

I found when I tried to add Qt 5.6.0 Beta in the extension I got the error "This Qt version uses an unsupported makefile generator (used: MSVC.NETMSBUILD, supported: MSVC.NET, MSBUILD)". The workaround is in C:\Qt\Qt5.6.0\5.6\msvc2015\mkspecs\common\msvc-desktop.conf Qt 5.6.0 splits all the version-specific changes into a separate file msvc-base.conf. If you copy the contents of this file and replace the line "include(msvc- base.conf)" in mscv-desktop.conf then Qt5Package recognises the Qt 5.6.0 Beta with no problems.

Note this still needs to be fixed in Qt5Package.

Solution 3

I had the same problem. But I've just found the magic key. The package in the following link has almost exactly the behavior of Qt Visual Studio Add-in 1.2.4 for Qt5. It includes everything needed to complete the work with Qt:

https://visualstudiogallery.msdn.microsoft.com/c89ff880-8509-47a4-a262-e4fa07168408

Share:
39,634
neoaggelos
Author by

neoaggelos

Updated on July 09, 2022

Comments

  • neoaggelos
    neoaggelos almost 2 years

    Searching Google for 'Qt5 - Windows 10 - VS 2015' only brought up a blog post from April stating that support for VS 2015 is in the works (link).

    The Qt5 downloads page (OpenSource version) currently has no links for Visual Studio 2015. So, is it possible to use Qt5 in VS 2015, or do I just have until something new comes up?

    PS. I just want to avoid installing VS2013 on top of VS2015. I can build from source should it be needed.

    Thanks in advance

  • neoaggelos
    neoaggelos over 8 years
    Thank you for this, even though a lot of time has passed since I asked the question, I never really found a solution.
  • Christopher Schneider
    Christopher Schneider over 8 years
    Greg, thanks for your post. It pointed me in the right direction. I'm not very experienced building C++ libraries like this from scratch, and things always seem to go wrong. I can't figure out why the QT Team hasn't hosted a pre-compiled binary for VS2015 yet. It's rather frustrating. Regarding your bat file, I let it run overnight and it worked. However, nmake install wasn't executed so there appears to be something wrong when changing directories.
  • Gregory Pakosz
    Gregory Pakosz over 8 years
    If nmake install wasn't executed it means nmake failed and something didn't compile correctly
  • gil_mo
    gil_mo over 8 years
    Nice and comprehensive article. Can you please save us the process and place the built libraries somewhere for download?
  • Gregory Pakosz
    Gregory Pakosz over 8 years
    I'm sorry I won't host Qt prebuilt binaries for different reasons: 1. I don't have a proper hosting plan for that task (it weights 3.34GB for both 32 and 64bit builds) 2. it's prebuilt with my own view of which configuration settings should be applied 3. it's a rather bad idea to blindly download non official binaries from the internet
  • robsn
    robsn about 8 years
    Thank you, this worked for me out of the box. I had no issues adding Qt 5.6.0 beta.
  • bvanlew
    bvanlew about 6 years
    Thanks for the article and the handy script. To get the script working I did have to add the ICU libs explicitly: -L %ICU_DIST%\lib -I %ICU_DIST%\include at the line (line 52 in the x64 script) with the call to configure. Without that there were unresolved ICU symbols. This was needed even though the script includes a SET LIB=%LIB%;%ICU_DIST%\lib at line 35.