xaxxon
xaxxon

Reputation: 19771

How to use clang 5 with qt in qt creator?

I've configured my locally installed version of clang 5.

enter image description here

and set up a kit with it

enter image description here

but when I do a build with it:

enter image description here

it's clearly still using the system compiler for qmake, which causes a bunch of errors because my code requires C++17 support:

enter image description here

How do I set what compiler qmake is using?

Thank you.

Upvotes: 1

Views: 2764

Answers (1)

p-a-o-l-o
p-a-o-l-o

Reputation: 10067

You can do it in your pro file, directly:

QMAKE_CC = /path/to/the/c/compiler
QMAKE_CXX = /path/to/the/c++/compiler

but you'd be better specify the correct Qt mkspec in your kit, which could be something like linux-clang. Check the mkspecs directory, see if in some of its subdirectories there is the right qmake.conf already, if not you can make a new subdirectory in mkspecs and a new configuration file inside it. The mkspecs directory should be in the path given by the terminal command

qmake -query QT_INSTALL_ARCHDATA

Hope it helped.

Upvotes: 4

Related Questions