Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compilation of C++14 in qtcreator

I have a qt project containing parts in C++14.

Recently, I changed my ubuntu distro. Now I have 16.04 LTS and I installed Qt creator 4.02 (built on jun 13).

In order to enable C++14 compilation, I put in the project file:

QMAKE_CXXFLAGS += -std=c++14

However, when building project, the IDE generates the following command:

g++ -c -pipe -std=c++14 -g -O0 -g -std=gnu++11 -Wall -W -D_REENTRANT ...

As seen, the generated makefile puts the flag -std=gnu++11 which overrides the flag for C++14. This did not happen with my previous distro (LTS 12.04, same qt creator version).

I tried with

CONFIG += -std=c++14

But the behavior is the same.

Could someone give any clue?

like image 698
lrleon Avatar asked Jul 10 '16 15:07

lrleon


People also ask

Does Qt support C++ 17?

As mentioned, Qt 6 makes C++17 a requirement in order to adopt its more advanced language features.

Does QT have a compiler?

Qt is supported on a variety of 32-bit and 64-bit platforms, and can usually be built on each platform with GCC, a vendor-supplied compiler, or a third party compiler. In Qt Creator, a kit specifies the compiler and other necessary tools for building an application for and running it on a particular platform.

Does Qt support C ++ 11?

Qt Creator is not a compiler. When you read that "Qt Creator supports C++11" it means that the code-completion engine (Clang in this case) supports C++11 syntax.


1 Answers

Instead of:

CONFIG += -std=c++14

Use:

CONFIG += c++14
like image 166
jonspaceharper Avatar answered Sep 22 '22 07:09

jonspaceharper