Adding extra compiler option in Qt

smallB picture smallB · Jul 7, 2011 · Viewed 68.1k times · Source

Where in Qt can I specify additional compiler options? Like for example -std=c++0x?

Answer

Dotti picture Dotti · Jul 7, 2011

You can try adding

QMAKE_CXXFLAGS += -std=c++0x

to your .pro file.

However, this should not be used in Qt 5 for enabling specific c++ standard. Instead, c++11 or c++14 in CONFIG variable to do that. It will enable GNU extensions (-std=gnu++11), but if that is unwanted, also add strict_c++ if you want to disable those. For example, this should pass -std=c++11 to the compiler:

CONFIG += c++11 strict_c++