How to change compiler (GCC) in Qt? I've installed GCC 4.4 and 4.6. At the momment Qt uses 4.4 but I'd like it to use 4.6. How to do it?
For QCC, also specify the path to the QNX Software Development Platform (SDP) in the SPD path field. To enable Microsoft Visual C++ Compilers (MSVC) and clang-cl to find system headers, libraries, and the linker, Qt Creator executes them inside a command prompt where the environment has been set up using vcvarsall.
Qt Creator uses the C++ compiler from the GNU Compiler Collection on Linux. On Windows it can use MinGW or MSVC with the default install and can also use Microsoft Console Debugger when compiled from source code. Clang is also supported.
To switch themes, select Edit > Preferences > Environment, and then select a theme in the Theme field. You can use the Qt Creator text and code editors with your favorite color scheme that defines how code elements are highlighted and which background color is used.
In the build sequence it may have a qmake
command like qmake YourProject.pro -r -spec linux-g++-64
the choice of the tool chain is done in the spec
file here linux-g++-64
. Your will find this file in path-to-the-sdk/qt/mkspecs/linux-g++-64
(you get the concept right?)... If you open the spec file you will see that it includes the linux
spec and the g++
spec.
One solution is to copy the g++
spec file and rename it g++-4.6
for example edit it and change :
QMAKE_CC = gcc
QMAKE_CXX = g++
to :
QMAKE_CC = gcc-4.6
QMAKE_CXX = g++-4.6
Idem for the linux-g++-64
it can be copied to linux-g++-4.6-64
and modify the include(...)
command to include your new g++-4.6
file.
Finally build your project with qmake YourProject.pro -r -spec linux-g++-4.6-64
.
I hope it's clear :) ...
I realise I am very late for the party but on Linux it is as simple as follows:
qmake -makefile <your-project.pro> -spec linux-clang
On my system, all sorts of different mkspecs
are available at:
/usr/lib/x86_64-linux-gnu/qt5/mkspecs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With