我的是ubuntu下编译c++ primer plus的这么一段程序
#include
#include
using namespace std;
int main()
{
string str("abcd"):
for(auto c : str)
cout << c << endl;
}
报错提示如下:
warming:auto changes meaning in C++11;please remove it [-Wc++0x-compat]
error:c dose not name a type
warming:range-based for loop without a type-specifier only available with -std=c++1z or -std=gnu++1z
我觉得是不支持c++11的auto才引发的一系列错误,但是不知道如何改