Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable C++14 in QtCreator's [Clang]CodeModel

How do I enable C++14 in the ClangCodeModel (or even the "normal" one)?

I added CONFIG += c++14 in the .pro file and the project compiles fine with both gcc and clang but the IDE is annyoing me with spurious warnings on C++14 constructs.

When looking at the "C++ Code Model Inspector", the "Project Parts->General" tab says

Language Version CXX11

despite the config entry. It seems the IDE's CodeModel does not pick that up.

like image 294
Nobody moving away from SE Avatar asked Jun 27 '16 12:06

Nobody moving away from SE


1 Answers

Go to Tools -> Options -> C++ -> Code Model.

Find the group "Clang Code Model Warnings" and "Copy" the current configuration ("Warnings for almost everything [built-in]" by default) in order to edit them.

In your new configuration add:

-std=c++14

to the end of the list of warnings and restart QtCreator. Just hitting apply or even refreshing the model does not work.

Afterwards the warnings should disappear. Let me know if it works!

I'm using Qt Creator 4.0.3 on Ubuntu 16.04.

like image 149
Clemens Sielaff Avatar answered Nov 04 '22 22:11

Clemens Sielaff