How do I link Qt 5.6 with MVS 2015? - c++

I have downloaded Qt opensource library version 5.6 and been through the installation steps provided.
I have added the bin folder to my path environment as well as the include environment and the lib variables.
I also installed the Qt 5 package extension for visual studio 2015.
The first error I have when I attempt to create a Qt application project is:
"Cannot instantiate QTProjectEngine object!"
My second error:
When loading a template project and try to run the program in debug mode, I get the error:
"The following error occurred:
There's no QT version assigned to this project for platform Win32. Please use the 'Change QT version' feature and choose a valid Qt version for this platform."

Possibly you may need to configure Qt versions first. Note: the VS extension and installed packages are not initially connected anyhow (though extension may attempt to search for one, not sure).
In VS 2013 and Qt 5.4 to configure Qt version:
From the main menu select Qt/Qt options
Click Add and enter correct values, example path: C:\Qt\Qt5.4.0\5.4\msvc_2013_64

Related

Qt 5.6 VS 2015 Add-in asks to specify default version

My story starts same as here Qt 5.6 VS 2015 problem
I have installed this
http://download.qt.io/development_releases/qt/5.6/5.6.0-beta/qt-opensource-windows-x86-msvc2015-5.6.0-beta.exe.mirrorlist
And tried it using this extension on VS
https://visualstudiogallery.msdn.microsoft.com/c89ff880-8509-47a4-a262-e4fa07168408
I've faced the same problem as described in that question. And the answer solved my problem as well.
But now I have another error. I've searched on the net but couldn't find anything related to. By now, QT path in Qt Add-in is set. Every time I click 'Open .pro project' it tells me
The following error occurred:
The default Qt version does not support Visual Studio 2015.
In order to import .pro files specify a Qt version >=5.2 as default.
So, the question is how to specify a Qt version. Probably it's one line in a config file, but in which one?

C1083: Cannot open include file: 'GL/gl.h': No such file or directory

I was using QtCreator for some time to play with OpenGL, and everything was ok. But finally i needed to attach a debugger to QtCreator, so i have installed windows 7 SDK. From this time i get error:
C:\Qt\5.4\msvc2012_opengl\include\QtGui\qopengl.h:122: error: C1083: Cannot open include file: 'GL/gl.h': No such file or directory
It is a problem only on my office computer, when I work at home everything compiles. So the problem is maybe with compiler?
This happened to me today...
For some reason the QT installer defaults to the MSVC 2012 32Bit OpenGL kit instead of the correct (in my case) MSVC 2013 64bBit OpenGL kit.
So I would check if there is a mismatch between the installed kits and your OS and/or MSVC version.
In my case opening the MaintenanceTool.exe (in the Qt dir) selecting Package Manager then uninstalling the "bad" kit and selecting the "good" one solved the issue.
Edit: in the package manager it refers to Prebuilt components, but they show up in Qt Creator as kits...

Qt Creator with Visual C++ 11

I want to use Qt Creator with MS VC++ 11 but it says there is no toolchain to build Qt.
I installed Qt with the full SDK installer.
What to do now?
Isn't MSVC++ 11 comes with Visual Studio 11? If so then Qt hasn't supported makespec file for that version AFAIK (correct me if I am wrong). But following are the (rough) steps for running Qt Creator with MSVC 2010 nmake/cl tool-chain..
Download Qt SDK 4.8.2 compiled using msvc-2010 toolchain from this site (second page).
Install MS VC++ 2010 free development tools (or full SDK), which comprises of nmake/cl/cdb executables.
Restart PC so as to initialize environment variable and all.
Start Qt Creator, by now you will notice msvc-2010 tool-chain has been identified by Qt Creator (Tools -> Options Dialog). If not then manually add it.
Also confirm that Qt version 4.8.2 of msvc-2010 has been identified in Qt Versions tab. If not then manually add it by giving path of qmake in bin of Qt SDK folder. It will also select msvc-2010 tool-chain automatically.
Here you go, now go to Projects and in Build Settings, select msvc-2010 tool-chain and compile. Make sure win32-msvc2010 is selected as makespec file.
Hope this helps.
try building using the makespec of Visual Studio 2010.
SET QMAKESPEC=win32-msvc2010
before running configure and qmake should do the job

"There's no Qt version assigned to this project for platform Win32" - visual studio plugin for Qt

I have a Qt project I am working on in Visual Studio 2010, with the Qt Visual Studio Add-in (for Qt 4.8). The project is running fine on my work machine, and I am trying to run it on my home machine. When I try to build, I get the following error:
There's no Qt version assigned to this project for platform Win32.
Please use the 'change Qt version' feature and choose a valid Qt
version for this platform.
However, it's set up to use a valid Qt version (another project I'm working on at home uses this plugin as well). Why is this occurring? When I got to Qt -> Qt Options, I see a valid version (4.8.0). Thanks
Did you select a proper Qt version in the Qt settings of your project?
More detailed:
If you right-click on the project there should be a "Qt Project Settings" option (or similar - I use the german version) near the end of the context menu. In there you can set the Qt version that this specific project uses. Is this one possibly not set correctly?
Solution:
Right click your project;
Qt Project Settings;
Under the Properties tab, you will find the option Version;
change it to a proper value;
Now, go ahead with your project.
Hope to help
Had the same problem with a x64 Visual Studio 2019 solution on Windows using Qt 5.15.0. Based on the answer from #Fabian and the excellent comment from #sitting-duck:
Install the Qt VS Tools extension
Select Extensions > Qt VS Tools > Qt Options
On the Qt Versions tab click Add
Set "Version Name" to something like "Qt-5.15.0"
Set "Path" to "[QT-PATH]\5.15.0\msvc2019_64"
Open Project Properties > Qt Project Settings > General > Qt Installation
Ensure this is set to "Qt-5.15.0" and close Project Properties
Right-click the solution (in the Solution Explorer tab) and select Change Solution's Qt Version
Ensure Qt-5.15.0 is selected
You should be good to go.
Open vcxproj file in a notepad, look for QtVersion...something=...
Ensure that the version value is really 4.8.0 (or whatever is your actual QT SDK version).
I found this issue too. and I found the solution .
you must keep the Qt version name is exactly same with the project create using.
which you think u can change freely,but actually not.
If you want to move Qt project between different computers, it's a good idea to use the qt project file, and not the MSVC (.vcxproj) one. So when you move from your work machine home, create a .pro file (in the Qt menu, you find the neccessary options to do that), and then load the .pro file at home, again using the Qt menu inside MSVC.
Another thing this could be is the platform being used is not the platform you think it is. In MSVC right-click on project, select properties, and then press configuration manager. Then check that all configurations and platforms are as you expect them to be.
I got the same problem during migration from Qt5.9 to Qt5.10.
We have a solution (Visual Studio) which consists of many projects. Some of them have QtVersion = "Qt5.9" and others have QtVersion = "Qt5.7" (yes, it were inaccurate project settings)
So, after I change all Qt project's settings from 5.9 to 5.10 automatically and remove Qt5.7 from versions list - I got the same error. This error was fixed trivially - I just add back Qt5.7 to the versions list (temporary until ALL projects' Qt version was not changed to 5.10).
In my case, I ported a Visual Studio project, with all its files (including .sln, .vcxproj, etc) to another computer using git. When I set everything up on the new computer, I accidentally selected a different folder for the Qt executables in VS (I selected C:\Qt\5.9.9\winrt_x86_msvc2017 instead of C:\Qt\5.9.9\msvc2017_64). When I double-checked which I had selected on the original computer, and then selected the same on the new computer, all was good.
To select a Qt folder: Extensions -> Qt VS Tools -> Qt Options -> Add -> Path (Version Name is auto-filled once you select the path).
This all describes the process using Visual Studio 2019, with the Qt plugin found here.
You could follow AlainD's instruction.
It work for me.
Just Right-click on Solution -> Change Solution's Qt Version
It will make change for its all projects.

Qt 4.7.1, Qt Creator and VS 2010 installation problems

On my computer (Win7 32, VS2010 Ultimate) I would like to use Qt Creator and Qt Visual Studio add in, both LGPL versions.
There are minGW and VS2008 versions of Qt frameworks on the Nokia websites, I did not find VS 2010 version.
So I have installed Qt 2010.05 SDK and in the VS 2010 Command prompt the following steps have been performed:
configure -static
nmake sub-src
I checked Qt Creator and it successfully runs. After the translation has been finished I installed VS 2010 add I tried to add new Qt version int the path
C:\Qt\2010.05\qt
But the following error message has been appeared:
Qt in the given path was built using minGW
It do not understand why because the translation has been performed for the VS2010.
Where is the error? How to install it correctly?
I found out from a German Qt forum that, VS add-in looks for libqtmain.a and libqtmaind.a files to determine if it is built with MinGW. Guess what? Qt ships with those files.
Delete them, and you will be fine.
FWIW, The Vs2008 version works fine with VS2010. I didn't need to build it or anything. You can install that and then just run the latest version of the VS plug-in installer and you should see the Qt menu options in VS2010.
AFAIR your command line is incomplete: I remember one had to specify the build platform. It could be that it's using mingw to build Qt since you didn't specify the VS version in the parameters. The following post might be of interest to you: Building Qt 4.5 with Visual C++ 2010