使用时的矢量库错误

问题描述 投票:0回答:1

我正在学习矢量库,我已经编写了这个关于矢量的简单程序,但在编译时遇到了61个错误。

这是我的代码:

#include <iostream>
#include <vector>
#include <Windows.h>

int main()
{
    system("color 0B");

    std::vector<int> s;
    s.push_back(3);
    s.push_back(4);
    std::cout << s[0] << std::endl;
    std::cout << s[1] << std::endl;

    system("pause");
    return 0;
}

这是我得到的一些错误,我不知道为什么?

Code    Description                                       File   Line
C2059   syntax error: ','                                vector  461
C2238   unexpected token(s) preceding ';'                vector  462
C3646   '_Val_types': unknown override specifier         vector  504

和许多其他错误......

这里是从第460行到第464行的矢量文件的源代码,两个第一个错误在第461和462行

矢量文件代码形式460到464:

  typename _Alty::const_pointer,
  typename _Alty::reference,
  typename _Alty::const_reference> >::type,
  _Val_types;
};     


c++ vector
1个回答
0
投票

该计划很好。我最好的选择是你无意中修改了第461行附近的矢量头文件 - 如果这是你遇到的第一个错误。

正在使用Visual Studio?检查“构建输出”窗口以查看首先出现的错误,然后双击该错误以转到源代码行。也许你会发现你输入的那些不属于那里的角色。

© www.soinside.com 2019 - 2024. All rights reserved.