Compiler configuration for Qt Creator - qt

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

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.

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!

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!

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.

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.

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.

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!

Related

QT application on BeagleboneBlack

Hi I have a debian image on BBB I have already installed QT creator on B^3 but the problem is whenever I try to start a new project in qt creator, couldn't see any option of kit. Infact when i add qmake and compiler path the application throws error.
What can I do to solve the problem. Can i directly get the full pack of SDK from qt.io/download ?
You must compile Qt libraries for your device (BBB) on your own, using specified compiler. You can find more information on this topic, here:
Qt Cross-Compilation Options
As soon as you compile Qt libraries for your device, you must move them to appropriate directories (on your BBB).
First, I would suggest learning to cross-compile, it's much faster & more easily maintained when you want to move to new versions. There's a ton of documentation and community around doing this. Windows & Linux both of which are probably dated, but info is still relavent. I've heard it's much easier from a linux host, but that could be biased.
That being said, if you don't want to cross-compile I believe you can simply install the qt embedded libraries. This question may offer some good advice. Once you have the libraries installed, you should be able to use qmake directly to create the Makefile for your project, then you can use cmake, or g++, etc.. to do the actual compiling.
You're likely going to work in command line though, I'm not sure you can run QT Creator on the BBB directly. I could be wrong.

QT Creator, compiling and deploying a c or c++ to a remote device (BeagleBone or R pi)

I'm trying since days to write and develop programs on my host pc (Ubuntu 64bit) using qt-creator for my beaglebone and raspberry pi devices.
I looked for 'qt-creator cross compile beagle, raspberry etc...' and it leads me to hundred of links and tutorial on how to compile qt-creator for my target plattform. But seriously, that not my idea. All what I want is to simply use my pc for developing my programs and lately deploy them to the remote device.
So first of all a noob question: Is something wrong with my idea? Should I really compile the source of qt for beaglebone or raspberry on my pc for writing programs which lately should be run on that devices????
I will not compile qt-creator again for another plattform, so I don't know how to find the right way. A lot of informations on internet are misleading.
So after many hours spend look for the right information I come up with the following procedure:
first I installed a arm-gnu toolchain on my 64bit Ubuntu.
sudo apt-get install build-essential libc6-armhf-cross libc6-dev-armhf-cross binutils-arm-linux-gnueabihf linux-libc-dev-armhf-cross libstdc++6-armhf-cross gcc-4.8-arm-linux-gnueabihf g++-4.8-arm-linux-gnueabihf
then I installed qt-creator from the repository on my Ubuntu:
sudo apt-get install qtcreator
I tried to configure to use qt for compiling my projects using the toolchain for arm (see following pictures)
and here:
but it seems that qt-creator doesn't recognize the new kit when I start a new project:
Now: I m really confused, I could think that the problem is related to qt, but I m not sure, whether the way of thinking, that I can compile on ubuntu 64bit and then run my application on the remote device is right or not.
For this reason it would be nice if you can answer the question above.
UPDATE: What happen if I add a QT-Version in my Kit???
It happens that the gnueabi compiler conflicts with that options and the following problem arises:
I would like to say again that I don't need to use qt-library or something like that on my remote device. I need just to use the qt-IDE as IDE for my projects (mainly c or c++ plain projects)
You need a complete toolchain
A toolchain is just a name for a group of things:
Compiler for the target platform (or cross compiler in your case)
Sysroot: An image of the filesystem in the target platform
A cross compiling qmake
QtCreator and the kit
You are lacking a cross compiling qmake. Please see my answer at this other post.
Furthermore, you need a toolchain for the Pi, and another toolchain for the Beagle.
It looks like before the update in the question, you didn't even have a valid kit, so there was nothing the IDE could do. You need to create a kit, and set Qt Version to None - because whatever Qt version you have installed is not for the ARM target. So, as long as it'll be none, it should work then, assuming that you have installed a full ARM toolchain for the target, including the Linux-specific bits - since you're not building a bare-bones application, but an application that will run on Linux.
When creating a new project, make sure to select Non-Qt Project, either C or C++, and choose the CMake build system (not qmake or qbs).
To test this out, start with creating a kit for your host platform, without selecting a Qt version (set it to None), and make sure you can create a simple C project and build it (choose proper compilers etc). Once you have done that, you should have an idea how to proceed with building for your ARM Linux targets. It really shouldn't be problematic at all (it all "just works" in my experience), so you probably didn't install something major (related to the target toolchain, nothing to do with Qt nor Qt Creator).
In Derek Molloy's tutorial for the Beaglebone on this subject, he mentions at around minute 18 that installing QT directly through the command sudo apt-get install qtcreator, won't install all the features of the QT app.
Try downloading QT directly from Qt site.

Installing Qt Creator with MinGW

So it looks like with Digia taking Qt over from Nokia, that it's quite a mess to get a few simple downloads.
If I now go to the downloads page (http://qt-project.org/downloads), I see that there's a single Qt Creator 2.6.2 download for Windows. When I download this and run the installation, it seems that MinGW is no longer packaged along with it.
I tried to install MinGW 4.4 separately and then add a toolchain, but nothing runs when I try to compile my CMake-based project.
I then came across the Nokia website that is offering Qt SDK 1.2.1; however it now looks that they require you to create an account to be able to download the installer.
Downloading the full set of Qt libraries is probably what is going to be suggested, but that's not the best idea, because I'm basically writing up an installation procedure for a CMake-based, open-source set of libraries that I've been working on for a while (http://tudat.tudelft.nl).
Users aren't happy with having to download all the Qt libraries, since we're not using any of them.
I've completely run out of solutions now (and mind you, this only seems to be a problem for Windows, since when I install Qt Creator on Linux and Mac, GCC auto-detection seems to work fine).
So, in short, does someone have a simple install routine to install Qt Creator and get it to work with MinGW to compile a CMake-based project?
Thanks in advance!
Kartik
PS: I know there are plenty of threads on Qt Creator + MinGW, but they all seem to be outdated now with the recent changes on both the Digia and Nokia websites.
I should add that the problem specifically is not that the toolchains can't be auto-detected under Windows. I've managed to get both MinGW and CMake auto-detected by Qt Creator by adding both to the system path. The problem is that when I then try to open the CMakeLists.txt file for my project, I can't select any generators.
Straight forward:
Install Qt Framework
Install MinGw
Install CMake
Install other stuff, e.g. git
Install Qt Creator
As you already mentioned, the chances are good that Qt Creator gets everything via auto detect. Nevertheless, you should check the Qt settings if everything is in place, e.g. the debugger.
The first time you open a cmake project, Qt Creator (should) ask for the tool chain to use. If you want to change the chain afterwards, delete the build files and cmake directories.
More details to Qt Creator and cmake: http://qt-project.org/doc/qtcreator-2.7/creator-project-cmake.html

Problem installing QT on Vista

I have downloaded QT SDK LGLP (Creator + libraries) 4.6 and I am having problems compiling projects. After install I have added C:\Qt\2010.02\qt;C:\Qt\2010.02\qt\bin to PATH and added QTDIR env varaible containing C:\Qt\2010.02\qt, the I run "configure -platform win32-g++" to compile it. Everything went good.
I the tried to use QT Creator to create and compile a project.
The problem is everytime I try to compile I get the following error message:
No valid Qt version set. Set one in Tools/Options
Error while building project GUITest
When executing build step 'QMake'
Canceled build.
When I go to Tools/Options the manual version is set to v4.6.2, Location c:\qt\2010.02\qt\bin\qmake.exe. The auto detected version is set to even though I have added the dirs in Path. Is there something I am doing wrong here? Has anyone encountered this problem in Vista.
I have been working on this for 2 days, change configurations, reinstalled etc...
The QtDir value is compiled into the
qmake-binary. You can only change this
by recompiling qmake and passing on a
different value to qt-configure (I'm
not sure which setting or variable is
passed on to qmake) When using
precompiled, downloaded binaries,
you'll have to keep the QtDir at
c:\Qt\4.6.2
EDIT:
What I said was incorrect. The locations of qmake, moc,... are located in the file:
<Qt>/4.x.x/.qmake.cache
Try uninstalling/reinstalling qt creator
But i highly suspect you didnt compile qt properly as this problem seems really odd. I had alot of problems compiling so i know myself from the past mistakes.
Make sure you carefully reread install instructions for your environment, also if you have visual studio you need to follow procedure to install it in compliance with it. Same if you use another c compiler
If nothing goes right, the easiest way to install qt imo is directy from their git hub, chec installin qt from git, on their git site there is wiki that explains how to do it
its really easy and after that all you need to do is add the qt to creator
Hey, it QT emulators have lot of problems in vista, i have tried several times,it didnt work for me.. it works well with windows XP. though ill tell you in brief what you need to do
1)install latest perl
2)install carbide c++ editor
3)install Qt SDK
4)install s60 or N97 emulators
make sure that except perl all the items which are mentioned above will be in same drive,and also
make sure that folder names which you give while installation should not have spaces at all..
i.e suppose if you are going to place any of the above items in a folder whose name is having spaces it will not work.
if you have any doubts feel free to ask.

Qt create executable

Is there a quick, straightforward way to make a Qt application into an executable? I attempted to follow the instructions at http://doc.qt.digia.com/4.1/deployment-windows.html but have been unsuccesfull thus far; I'm unable to Any help would be much appreciated. Thanks!
I always use CMake to build Qt projects, it's easy, free and cross platform. Guide : Compiling Qt4 apps with CMake. CMake also come with CPack to easly make installer for Windows, Mac and Linux.
I agree with chmod700 about the Qt Creator suggestion, it's not my favorite IDE but it's still really nice and easy.
Do you mean an installer package? I assume you are able to compile, link, and run your app and you mean how do you package it up for others.
http://installbuilder.bitrock.com/ <-- special handling of Qt based projects but costs $
http://www.jrsoftware.org/isinfo.php <-- my personal favorite and it's free (can be rough to learn advanced features though)
Though if you mean how do you build your app, you may want to try the new Qt Creator (http://www.qtsoftware.com/products/appdev/developer-tools/developer-tools#qt-tools-at-a) which will setup build targets for you and really makes desktop Qt dev a snap. Also if you're still using 4.1, you can now use 4.5 under the LGPL on all platforms making it almost a no-brainer to upgrade.
I'm not sure if I understand your problem. Assuming you're using MinGW, it's really easy and quite straightforward:
get the Qt sources and unpack them to some folder (f.e. c:\Qt\4.5.0-static)
install MinGW. Make sure the MinGW executable folder is in the %PATH% variable.
open a cmd windows, go to the Qt sources and run configure -static. You can add other config options if you like to, but usually you don't need that.
when building Qt finished, go to your application sources, open a cmd window and run the qmake of your built Qt installation -- i.e. c:\Qt\4.5.0-static\bin\qmake in the example given above.
run make
you get a statically linked binary in the end (you might want to check it with Dependency Walker).
Doing the same using Visual Studio is pretty similar.
Or do you want to build dynamically and create an installer package?

Resources