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).
However upon trying to compile with the flags -std=c++11 -std=gnu++11
, I get repetitions of the errors
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
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? (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. The initial support for nascent C++11 was enabled by -std=c++0x
setting. This is probably what you should try.
And yes, the for
syntax you are trying to use is chiefly C++11 syntax.
It appears as if range-based for loops are supported in 4.6 and newer.
This page shows GCC support for C++11 features.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With