Building Qt project for C++11 standard

↘锁芯ラ 提交于 2019-12-12 20:13:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!