C++: Syntax error C2061: Unexpected identifier

后端 未结 5 1548
梦如初夏
梦如初夏 2021-01-06 12:33

What\'s wrong with this line of code?

bar foo(vector ftw);

It produces

error C2061: syntax error: identifier \'vector\'
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-06 13:24

    Probably you forgot to include vector and/or import std::vector into the namespace.

    Make sure you have:

    #include 
    

    Then add:

    using std::vector;
    

    or just use:

    bar foo(std::vector ftw);
    

提交回复
热议问题