Compilation error with “for each” loop in C++ VS2010

后端 未结 6 871
无人及你
无人及你 2021-01-21 10:29

I was working on a little C++ project at home, which I brought into school to show my teacher. At home I have Visual Studio 2012, whereas the school computers have Visual Studio

6条回答
  •  误落风尘
    2021-01-21 11:00

    The for(char c : myStr){...} syntax is new with C++11, so anything using an older version of C++ won't compile with that syntax.

    Previous to C++11, for_each is defined in the algorithm header.

提交回复
热议问题