C++ version question, about " for(char c : str) ". #7152
-
What happened:After I typed in this code below, there'a an error. Which I think it is not supposed to appear. Codefor (char c : str) { Errorexpected a ';' // I think it means ':' supposed to be ';' Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is supposed to work (and works for me), but you need to make sure your cppStandard is set to c++11 or newer. Run C/C++: Log Diagnostics to see what is being used. Also, the "4.2.1" appears to reference a g++ header for an old compiler that doesn't support C++11. |
Beta Was this translation helpful? Give feedback.
This is supposed to work (and works for me), but you need to make sure your cppStandard is set to c++11 or newer. Run C/C++: Log Diagnostics to see what is being used. Also, the "4.2.1" appears to reference a g++ header for an old compiler that doesn't support C++11.