问题
I am trying to build my Qt project with C++11 standard. I added this flag in the build steps, additional argument option, in the Qt Creator :
-std=c++11
But I got this error while building :
Unknown option -std=c++11
g++ version info : g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Any ideas ?
回答1:
Use the qmake project file, add this line: QMAKE_CXXFLAGS += -std=c++11
LE: also 4.6.3 might not support C++11 (as far as i know 4.7 and higher support -std=c++11) so the option for the 0x features implemented might be: QMAKE_CXXFLAGS += -std=c++0x
回答2:
If you are using Qt5, add CONFIG += c++11
to your .pro file, that works on all systems.
来源:https://stackoverflow.com/questions/17299139/building-qt-project-for-c11-standard