How to use Visual Studio 2017 with Qt to develop GUI applications? - c++

I have searched everywhere but I can't seem to find support for the latest Visual Studio version.
Is there some way of getting round this?

Qt 5.9.1 and later versions are pre-built for VS 2017 64 bits. You can download it from official Qt webpage. If you need 32 bits I'm sorry to tell you that you will need to compile it manually (good luck, it is usually not a straightforward nor simple process). See updates below.
In addition, you will need the VS Tools. You can download latest version for VS 2017 from here (official downloads page hasn't been updated yet about this). There is no stable version for VS 2017 (see update below), but the latest (although a bit old) development build fixes major integration problems. You can downloaded from here.
Finally, just take a look at the official documentation for a quick tutorial about how to use it. Basically:
Configure your Qt version with the VS Tools: in VS go to Qt VS Tools > Qt Options and add your installation.
You can now create a new project. The extension will add a new templates collection under Visual C++ called Qt, there you will probably use the Qt GUI Application.
The rest is standard Qt programming. The VS Tools take charge of all the compilation of .ui files (interface design), moc'ing needed files, translations (if used), etc.
UPDATE: as mentioned in this post from MSDN, binaries generated usign VS 2015 are compatible with VS 2017. So in this case, the Qt compilations for 2015 (32 and 64 bits) should also work.
UPDATE (2018-9-13): since two months ago we've been using the 32-bits build from VS 2015 in VS 2017 (including the latest 15.8.4 update). No issues found so far in this sense.
UPDATE (2018-12-10): Qt 5.12.0 (LTS) comes with precompiled binaries for VS 2017 32 and 64 bits.
UPDATE: last February was launched the first official release of the VS Tools for VS 2017. You can read more on it in the Qt's blog.

Related

Can I use older minor version of C++ compiler in VS2019?

There are some bugs introduced in 16.7 that affect me, and I would like to use 16.6.
Most of the questions I found refer to using VS2017 compiler, I want to use VS 2019 compiler, just an older version.
Best I found in official docs is to remove VS and reinstall, but I would like to avoid that.
I found solution of such problem for myself in following way.
You should locate MSVC build tools of chosen version in your folder like "Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC XX.YY.ZZZZ. If you just upgraded your VS it didn't remove old build tools (I hope). If it did or you just installed newer versions you can use VS Installer to add/download MSVC Build Tools of one of previous version.
You should change links to VCTools of previous version for Toolset v142 (that is 2019). To do his you can change text files located at something like "2019\Enterprise\VC\Auxiliary\Build". Files of our interest are "Microsoft.VCToolsVersion.v142.default.txt" and "Microsoft.VCToolsVersion.v142.default.props".
That simple files just contains names of MSVC Tool version to use for Toolset v142
These changes will affect building of all you projects using toolset v142 (that is VC2019 Compiler)
I am sorry that VS does not currently support the ability to roll back a Visual Studio Update, you can only follow the method in the link. Luckily, Microsoft have already understood this issue and rolling back updates is certainly in their backlog. You could vote on this issue and express your demands.

Building QT Project with MSVC2013?

I am attempting to build some group's project with QT Creator and the only guide I got was that it should be built using MSVC2013. QT's regular kits do not have MSVC 2013 32-bit and 64-bit (I guess they don't go back that far), so I tried to download a legacy version (4.12.2) along with Visual Studio Express 2013 but I can't seem to find where to go from here.
Can someone suggest the cleanest way to build a complete QT project using MSVC2013? Preferably in a way that a VHDL developer would understand!

Installing Qt 5.5 on Windows 7

I would like to install latest version of Qt (5.5) on Windows 7 for C/C++ application development, and have a few questions:
Can I use Microsoft "Visual Studio Community" edition (2015) as the compiler?
I assume I need to install Visual studio first and then Qt?
I am going to install Qt from here, after downloading and installation do I need to build Qt? Or it is ready to go?
Is there a tutorial that explains all the required steps in details. I have done Google search and found bits and pieces here and there not not a good complete step-by-step reference.
Thanks for the help.
You need the compiler, which is integrated in visual studio. I don't think you can get the newer ones without Visual Studio (From official sources). However, you can use Qt on windows without msvc. You can build with the minGw compiler - but I personally like msvc more.
Regarding VS2015: It won't work without extra configuration. Qt 5.5 supports msvc2013 only (the next release, 5.6, will support the msvc2015 compiler). But Visual Studio 2013 will work. The order of installation doesn't matter.
After you installed Qt, all you need to do is launch Qt-Creator and start coding ;) If you wan't to use Visual Studio instead, there is a Plugin on the bottom of the download page ("Other downloads"). Visual Studio 2015 isn't supported here too, but 2013 is.

How to compile C++ for Windows with clang in Visual Studio 2015

As far as I understand, Visual Studio 2015 is shipped with clang. First I though this was only for Android and iOS apps, but according to this article it should also be possible to use the clang++ frontend for Windows programs. However, I can't find the according option.
So could you please explain to me, how I can change the used compiler to clang in a c++ project (in VS2015 RC Community Edition).
Starting with VS2015 Update 1 you can install the "Clang with Microsoft CodeGen" template via the New Project window, browse to Installed -> Templates -> Visual C++ -> Cross Platform.
You will then be able to choose the Clang 3.7 with Microsoft CodeGen v140_clang_3_7 Platform Toolset in the properties page of any Windows C++ project.
Clang has a completely different set of command-line options which it recognizes, so when using the v140_clang_3_7 toolset, the project properties must be using Clang-compatible options, which can be recognized as starting with - instead of /. For example, Debug Information Format property set to "Full Debug Information (DWARF2) (-g2 -gdwarf-2)", and Enable C++ Exceptions property set to "Yes (-fexceptions)".
There's more information in this blog post.
As far as I understand it both Clang and GCC are shipped with the Android and iOS crossplatform SDKs/tools for Visual Studio 2015.
From what I've seen it only allows me to choose those while having one of those crossplatform projects.
Using the template project for a GLES C++ application you get the following options:
While for a Windows C++ application you get the dialog below where you can see that Windows target platform is grayed out and read-only, meaning you probably have a set of toolkits for each target platform, but you simply cannot change it, at least for now.
Have no idea how you turn a normal VS project into crossplatform though, and it's likely that you can only target Android or iOS out of the box using 3rd party compilers.
It may be possible, though, to install Clang as another toolkit in the same way the XP toolkits are. So perhaps it's just a matter of someone fiddling with it and making it available as it is already installed.
Caveat: This answer is pre-VS2015 update 1 which didn't have the "Clang with Microsoft CodeGen" option.
After reading through the linked post and especially the comments again, I came to understand, that this is not a feature shipped with VS2015 RC but a possible future feature that might e.g. be shipped in a SP or (more likely) with the next version of VS.
As mentioned by sjdowling, the closest thing you can do at the moment (October 2015, clang 3.7) is to download and install llvm for windows. This should give you a LLVM-vs2014 platform toolset option. For me it works for simple test programs, but apparently this version of "clang-vs" seems to not yet support exceptions. However, according to these notes, that problem should be mostly solved for clang 3.8.
While the above solutions work they require that you have installed clang which is off by default in the visual studio 2015 installation. The accepted answer does show how to install it, though the next page will ask you to close visual studio which you are running the new project from.
If anyone is wondering how to install clang because it does not show up in their list here is another solution:
Control Panel->Programs->Programs and Features.
Right click on “Microsoft Visual Studio Enterprise 2015” (or
“Microsoft Visual
Studio 15 Preview” if you have the preview of the next version of
Visual Studio installed)
Click “Change”
Click “Modify”
Select “Clang with Microsoft CodeGen” – The March 2016 release.
https://blogs.msdn.microsoft.com/vcblog/2016/03/31/clang-with-microsoft-codegen-march-2016-released/

Gtkmm and cairomm with visual studio 11 (for the first time)?

I am learning c++ and wish to draw geometry to better enjoy the process and test my scripts.
I searched for a library to draw vectors in c++ and found Cairo came highly recommended on this site. I went ahead and downloaded Gtkmm that comes with Cairomm and installed it. I so far used this aweomse tutorial:
https://live.gnome.org/gtkmm/MSWindows/UsingMSVC
I followed the steps but I think this tutorial might be outdated or there may be an issue with one of the steps on MSVC 2012 with gtkmm-vc100-d-2_4.props (that is perhaps only supported on MSVC 2010).
In general I really want to get started but I am new to this and very confused atm.
It seems the current latest Project property file is not supported with Visual Studio 11 (2012).
I should have known that with the file name being, 'gtkmm-vc100-2_4'.
It works perfectly with VC10 so I reverted to using that for the time being.
I compiled gtkmm3 on Widnows 7 x64 (including cairo and others) for Visual Studio, see this
I have a CMake based project to build gtkmm on top of MSYS2 (it used to use OBS). It can be used with any version of Visual Studio supported by CMake as well as plain makefiles and jom makefiles.