How can I add another compiler and use it with QT?
I'm asking because I couldn't find it anywhere on the web how to do it.
-
which build system? which compiler?Frank Osterfeld– Frank Osterfeld2011-11-01 10:08:30 +00:00Commented Nov 1, 2011 at 10:08
-
@FrankOsterfeld windows, compiler gcc 4.6.1smallB– smallB2011-11-01 10:13:45 +00:00Commented Nov 1, 2011 at 10:13
Add a comment
|
2 Answers
If you are using qmake, you can override the compiler used by the current mkspec with QMAKE_CXX, e.g. qmake QMAKE_CXX=g++-4.6.
To permanently override it, you'll need a new or edit the mkspec files. You can browse where they are with qmake -query and look at the QMAKE_MKSPECS variable. From there, the directory "default" is used if you do not use the -spec parameter in qmake. In that directory, the file qmake.conf will contain the mentioned QMAKE_CXX paramater that determines the compiler.
5 Comments
smallB
is there a way to do it via IDE? I'm not using qmake.
Tatu Lahtela
Which IDE? If it's QtCreator it uses qmake internally by default, and the same rules apply. You can add the QMAKE_CXX from Projects side tab and build steps. If its not qmake, you'll need to refer to the build tool documentation about the compiler.
Tatu Lahtela
Assuming you have your project open in QtCreator. Click "Projects" (on the left side bar). Then click "details" on the qmake row, inside "Build Steps". You should see "Additional Arguments". Write "QMAKE_CXX=g++-4.6", or whatever compiler you want there. This of course assuming that the compiler is in the PATH and QtCreator finds it. Clean and rebuild.
smallB
am I suppose to change those XX in QMAKE_CXX or just leave it as it is. And another question connected with this: Am I suppose to somehow create this QMAKE_CXX or just type it as you've suggested? Thanks.
smallB
Tatu in "Additional Arguments" I've typed first time: QMAKE_CXX=C:\MinGW32\bin\g++, this doesn't work for me, second time: QMAKE_CXX=g++-4.6.1 - also doesn't work. My gcc 4.6.1 resides in C:\MinGW32\bin\g++ and this IS in PATH.