Qt Creator needs a compiler set up to build - c++

So i downloaded Qt and am designing my first GUI, and now it wont compile, i keep getting an error that says:
Qt Creator needs a compiler set up to build
I've searched around on the net but alot of it seems jargon, even the other Stack Overflow documents dont make any sense..
How do i set up a compiler for QT to use? I downloaded g++ compiler last night to use with Sublime Text 2, and that's working, so is there a way to make g++ work with Qt?
Thanks guys

(I supposed you're using Windows )
If you downloaded Qt for Visual studio you need to install visual studio too. Then go to
Tools -> Options -> Build & Run
in Qt Creator and then, in Compilers tab add new compiler.

Related

How can I change build tools for projects in VS Code?

I want to build a C++ code but it errors. When I check the error message it's related with .NET. I have C# extensions but this isn't C# and I want to change this to g++ for C++ projects. I have g++ installed and added to path however I don't know how can I configure it to build with that for C++ codes.
Edit: I marked the answer as a solution but I also found an easier way for me:
https://code.visualstudio.com/docs/cpp/config-msvc
cl.exe basically.
One option (probably not the one you want to) is to build it from integrated terminal.
You can download c/c++ extension along with the cmake tools extension to have buttons for build/run configuration.

Adding MinGW compiler to QT 5.6.0 Windows

I am a Total Noob at this and I know nearly nothing about this.
I just started using Qt Creator for windows 5.6.0 and While I wrote my first "Hello World" code..
I was asked to add a kit. I searched the net for similar issues and it said that I needed a compiler for Qt. Thus, I installed MinGW from QtForums
now when go to Tools->Options->Build&Run->compiler, I can not understand how do I add it to the list.
Please help me through it?
To just get started the easiest thing to do would be to go here:
Link to Qt downloads page
Scroll down and select Qt 5.6.0 for Windows 32-bit (MinGW 4.9.2, 1.0 GB) this will download the installer (its about 1 GB). Run it and choose all the default options. Then you will have Qt 5.6 with mingw and Qt Creator all setup ready to go.
Note: Before you start that its probably best to delete your current version - if you are not attached to it in any way :)
If you want to fix your current setup, then it might be longer-winded to find out what you are missing for mingw. For example you need the mingw qmake file that would be located here (using default install options):
C:\Qt\Qt5.5.1\5.5\mingw492_32\bin\qmake.exe
to create your "Qt Version" part of the kit. And the actual mingw compiler, which is located here (using default install options):
C:\Qt\Qt5.5.1\Tools\mingw492_32\bin\g++.exe
to create your compiler. Once you have both of these then you can put them together to create your new kit.
But to just add a compiler all you need to do is:
Click compilers tab
Click add and select mingw
A new compiler is added, click it
You will see some options below, add your compiler executable path in (like the one above for example).
And you are done - there are some other options, but you probably don't need to use them.
note my paths are for qt 5.5.1 (obviously) so slightly different to 5.6 :)
update
Its all been moved around! - here are the new paths:
offline-installers
old-version-archives
Well. I was unable to provide the data before but it all makes more sense now.
What I had installed was Qt for windows 64-bit (vs 2013, 836mb).
Hence, Instead of MinGW, I have msvc2013_64. It does have qmake.exe but doesnt have g++.exe. And I had downloaded it separately.
You're answer was very helpful.
Added MinGW packages to QT installation with the QT Maintenance Tool (C:\Qt\MaintenanceTool.exe)
It allows to add/remove components via the qt repositories. So no need for re-installation.

compiling Qt using nmake gives Command line error D8021 : invalid numeric argument ‘/FS’

I’m trying to deploy my Qt application to windows and I’m getting an error when I run nmake about /FS being an invalid numeric argument. It looks like it’s some kind of compile flag that’s not being recognized by the compiler. I have no idea on how to fix this and there doesn’t seem to be any information than what's already provided here http://qt-project.org/doc/qt-5/windows-deployment.html.
I posted my original question here Deploying a Qt 5.3 App on Windows
This person has the same problem Deploying a 32-bit Qt 5.3.0 app (Stand-Alone)
I’m on Qt 5.3 with Visual Studio 2013. As both question shows it seems to be running cl and nmake from VS 2010. I’m going to bet this is where the problem lies
Thanks for any help with this problem
Use cl.exe version 18.x to compile.
Had the same problem and it was me calling the wrong vcvars32.bat from qtenv2.bat, basically was using MSVC2010 with Qt for MSVC2013
As edwinc mentioned, compiler version should be 18.x
Qt 5.4.1, VS 2013. Fixed the issue by editing
C:\Qt\Qt5.4.1\5.4\msvc2013_64\mkspecs\win32-msvc2013\
removing faulty parameter from
QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t
I ran into this same problem trying to compile the deprecated QtHttp and QtFtp modules for Qt5. You're right that the cause of the problem is a mismatch in MSVC compiler versions. Here are some of the things I found out for others encountering this:
qmake is going to pull in the mkspecs from qtbase. So if you built Qt with one compiler and try to compile an individual module using a VS command prompt from a different version, it won't care that you used the correct vsvars bat.
qmake can be passed the -spec flag to force it to use a given spec. E.g. qmake -spec win32-msvc2010.
Compiling Qt with one compiler version and your app with another will probably compile and link fine. Then it will crash or fail to start when you try and run it, at best. Worst case, you'll get weird subtle bugs at runtime.
If you had multiple Qt Kits installed, potentially due to running multiple Qt Creators, switching between kits could lead to such problems. Be meticulous in ensuring that you're using the right Qt Kit and, if it's an auto detected kit, then you're using the right Qt Creator.
With your project opened, review your kit:
Options > Build & Run
Select Kits tab
Ensure your kit is selected
In addition consider clicking on "Make Default" to set it as your default kit
That kit should now appear in italic bold
Do a QMake follow by a Rebuild
Did you try compiling with VS itself? Does it work?
Anyway, try checking C1.dll in your C:/windows/... folder (try searching the directories below it), is it an old one which being created like, 5 years ago? If so, you may want to replace it with a newer version such as those included inside your VS2013 folder.

Create First Project in QtCreator, problems with kits

I've just switched to QtCreator for C and C++ developing. I have problem in creating first project, in particular with compiler kits I suppose.
When I go to create a new project, I have the error message that no kits is available.
As you can see, I don't know why it is shown that Qt Version is invalid. How could I solve?
You should first install your C++ compiler. You should also define your compiler in "Compilers" section. If you also want to use Qt you should set the compiler for your kit in the "Kits" section.
When you install QtCreator on MAC OS X you can find it in
/applications/qt
in this folder there is another folder called
5.2.1
Here there are all the compilers.
So to solve the issue you can either add, in QtCreator options, the path of every qmake.bin file or cut the 5.2.1 folder and paste in
/Users/YOURNAME/qt
creating qt folder if it doesn't exist.
PS: I've tried to make the directory invisible, but if I do so, I get errors using the second method

Missing compiler in Qt Creator

I recently installed Qt creator 2.8.1 online on my win Vista 32 bit machine.
To start with Qt I wrote simple pushbutton code. And when I tried to build it shows error message saying
Qt Creator needs compiler set up to build. Configure a compiler in kit
option
I tried with that Kit option din't work. what do I do?
PS Thank You
Simply refer to MINGW online install available at Qt's official downloads( http://download.qt-project.org/). You need not do anything. It will automatically detect an kits and will compile successfully.