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?
As mentioned, Qt 6 makes C++17 a requirement in order to adopt its more advanced language features.
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.
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.
Instead of:
CONFIG += -std=c++14
Use:
CONFIG += c++14
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With