[英]-std=c++11 flag unrecognized in G 4.4.6
I have some code written using the C++11 standards, and our g++ version is 4.4.6, so as far as I can tell, c++11 should be supported (from 4.3 onwards). 我有一些使用C ++ 11标准编写的代码,我们的g ++版本是4.4.6,所以据我所知,应该支持c ++ 11(从4.3开始)。
However upon trying to compile with the flags "-std=c++11 -std=gnu++11", I get repetitions of the errors 但是在尝试使用标志“-std = c ++ 11 -std = gnu ++ 11”进行编译时,我会重复出现错误
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-std=gnu++11"
Compiling with -std=c++0x produces errors such as 使用-std = c ++ 0x进行编译会产生错误,例如
DeviceInfo.cpp:22: error: expected initializer before ‘:’ token
corresponding to this line of code: 对应这行代码:
for (cl::Platform& plat : platforms)
Is this a c++11 specific bit of Syntax? 这是一个c ++ 11特定的语法位吗? (it doesn't look like it to me, but all this code has been given as an example so should work as provided with the compiler.
(它看起来不像我,但所有这些代码都是作为一个例子给出的,所以应该像编译器一样工作。
Any help? 有帮助吗?
-std=c++11
setting is supported by much later versions of GCC. 更高版本的GCC支持
-std=c++11
设置。 The initial support for nascent C++11 was enabled by -std=c++0x
setting. 通过
-std=c++0x
设置启用对新生C ++ 11的初始支持。 This is probably what you should try. 这可能是你应该尝试的。
And yes, the for
syntax you are trying to use is chiefly C++11 syntax. 是的,您尝试使用的
for
语法主要是C ++ 11语法。
for (cl::Platform& plat : platforms)
yes, it is c++11 specific usage. 是的,这是c ++ 11的具体用法。 GCC 4.7 or later supports c++11 with -std=c++11 option meanwhile.
GCC 4.7或更高版本同时支持带有-std = c ++ 11选项的c ++ 11。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.