2

I am trying to compile a Qt project that uses the "override" keyword, and thus needs GCC 4.8. I have installed GCC 4.8 on my Ubuntu 12.04 machine already, and it lives in /usr/bin as gcc-4.8 and g++-4.8.

I have added a compiler in the Qt Creator with the "Compiler path" set to /usr/bin/g++-4.8, and made sure the kit I am using is set to use this compiler. However, the Makefile that qmake generates still sets CC = gcc and CXX = g++. If I manually append -4.8, it does what I want. Why is qmake not generating the Makefile to do that? What am I missing in Qt Creator such that it points to the wrong gcc binaries?

I realize that update-alternatives could do the job, but I'd like to not have to have to run that just to run an alternative version of gcc. (Maybe in the future I will want two Qt projects with different versions of gcc.)

1 Answers1

2

Found out how to fix this: add the following to my .pro file:

linux-g++ | linux-g++-64 | linux-g++-32 {
    QMAKE_CXX = g++-4.8
    QMAKE_CC = gcc-4.8
}