error: in C++98 ‘nums’ must be initialized by constructor, not by ‘{...}’

 c++中使用vector类时 vector<int> nums={a ,b ,c ,d}编译g++ xx.cpp -o xx报错

 error: in C++98 ‘nums’ must be initialized by constructor, not by ‘{...}

应改为g++ -std=c++11 xx.cpp -o xx 或者g++ -std=gnu++11 xx.cpp -o xx

猜你喜欢

转载自blog.csdn.net/silenmm/article/details/76847442