Emelia Dede Quist
Emelia Dede Quist

Reputation: 71

Compiler configuration for Qt Creator

I am new to Qt and its IDE Qt Creator so pardon my ignorance. When I try to compile my code I get the exception

"Qt Creator needs a compiler set up to build. Configure a compiler in the kit options".

I have installed MingGW for compiling C++ code. However, I am having a problem configuring it for Qt Creator.

Any help will be appreciated. Thanks

Upvotes: 7

Views: 36953

Answers (7)

Bob
Bob

Reputation: 131

I am using Qt Creator 3.5.1 based on Qt 5.5.1. The error "No compiler set in kit" has been a problem every time I have to configure a development system. The solution that worked for me is to select Tools/Options/Compilers and add a compiler. In my case a GCC compiler with Name:g++, Compiler path:/usr/bin/g++. The trick is to add the compiler before trying to add a Kit. If I add a Kit before I add a compiler I can never add the compiler to the Kit. If you having this problem delete the Kit, add a compiler, then add the Kit.

Upvotes: 0

Mahmoud Abd El Samea
Mahmoud Abd El Samea

Reputation: 47

I was also having the same problem, so what I did was this:

sudo apt-get install g++ 
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev

I then closed the QT Creator, restarted it, and it worked.

I do not know which of the above two made it work, but it worked!

Upvotes: 2

Miguel
Miguel

Reputation: 1

Not always the last version is the better. If someone is learning Qt to implement production solutions, is not good idea to use Qt version 5 (see the Qt5 change log). If you want to learn Qt programming, I think that the Nokia SDK is a good starting point, because you only have to install it as another Windows software, and start to coding.

By using linux is another good starting point, because you will have all the develop environment with a few apt-get commands.

When I started programming Qt, I lost a lot of hours to get a complete environment working with QtCreator, and I understand that not everybody has time for it.

Upvotes: 0

Tobias Hunger
Tobias Hunger

Reputation: 1611

You are using Qt Creator 2.6.x, as those are the only ones that have kits.

Please go to Tools>Options>Build & Run>Compilers and add you mingw compiler there. You need to point creator to 'g++' in your mingw installation.

Then head over to the Kits tab and click on the desktop kit that creator should have created for you. In the details there is a field called Compiler (or Tool chain, don't remember). Select your mingw compiler there. Check the debugger field. If it is empty or using the gdb debugger that is part of mingw: Grab a debugger from http://builds.qt-project.org/, install it and point creator to that one. The debuggers delivered as part of mingw are known to not work well with creator.

Do not use the Nokia Qt SDK: Everything in there is terribly outdated by now!

Upvotes: 1

dualed
dualed

Reputation: 10502

I suspect you are using the new 5.0 Qt. It required a bit of prodding for me too.

If you look into Settings > Build & Run > Kits you should see an auto-detected entry which will probably have an exclamation mark in front and is not editable. Ignore this.

  • Add a new Kit
  • Give it a name, set the "Qt version" and select a compiler. (Compilers should have been auto-detected. If you do not see any compilers, you will have to set at least one up manually)
  • Click the "Make Default" button. (You may have to modify project build settings to use the new Kit too)

There may be a better way, but I do not know it. And you should probably use 4.x until 5 is out of beta.

Upvotes: 8

NG_
NG_

Reputation: 7173

In your questions you must provide us more information about your problem, such as what versions of software are you using.

About your question, I think, that very good idea to you (as a beginner) is to use all-in-box QtSDK (link, need registration). There are ready-to-use QtCreator, MinGW and litle bit old Qt Libs in that QtSDK 1.2.1. So, you dont't need to configure it at all.

Hope, it'll help. Good luck!

Upvotes: -2

Digikata
Digikata

Reputation: 1959

This is just a starting point to troubleshoot your question, but the Qt Creator preferences has settings in the "Build & Run" area where you can define the location of your build toolchain: compiler, Qt version to build, etc. For mingw you'd have to point the right field to the location of g++, for a Qt version the location of qmake.

Upvotes: 0

Related Questions