Qt – C++ Qt – How to add “-std=c++11” to the makefile which is generated by qmake

c++11makefileqmakeqt

I'm developing a program in Qt. Its makefile is generated automatically from the .pro file. I need to use some code which need the -std=c++11 flag to be set up for g++. Where in .pro should I add this flag? (changing only the Makefile won't work since it gets overwritten by the newly generated one, each time I build the project).

Best Answer

You can add the following to the Qt .pro for C++11: -

CONFIG += c++11

As of Qt 5.4, C++14 can be enabled with

CONFIG += c++14
Related Topic