添加QMAKE_CXXFLAGS + = -std = c ++ 11到qt中的.pro文件不工作(在linux 12.04上) [英] Adding QMAKE_CXXFLAGS += -std=c++11 to .pro file in qt not working(on linux 12.04)
问题描述
编译器输出:
[main.o]错误1
[main.o] Error 1
cc1plus:error:unrecognized命令行选项'-std = c ++ 11'
cc1plus: error: unrecognized command line option '-std=c++11'
推荐答案
解决方案是更新系统上的古代gcc版本。事实上,我很惊讶,你有这样一个旧版本在您的12.04 Ubuntu版本。它应该有4.6.3由deault。
The solution is to update your ancient gcc version on the system. In fact, I am quite surprised that you have such an old version on your 12.04 Ubuntu variant. It should have 4.6.3 by deault.
你可以尝试是c ++ 0x而不是c ++ 11,看看是否使其工作。您还可以通过发出 man gcc
启动gcc手册,并查找精确的选项。
What you could try is c++0x instead of c++11 and see if that makes it work. You could also fire up the gcc manual by issuing man gcc
and look for the precise option.
我们是,你可能只是写在你的qmake项目文件,而不是这样的原始配置:
Also, while we are it, you could probably simply write this in your qmake project file instead of such raw configurations:
CONFIG += c++11
这篇关于添加QMAKE_CXXFLAGS + = -std = c ++ 11到qt中的.pro文件不工作(在linux 12.04上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!