如何定义矢量

how to define a vector

本文关键字:定义 何定义      更新时间:2023-10-16

我在类的头文件中得到了以下内容:

#include <vector>
#include <math.h>

在类描述中,我有以下受保护的成员:

vector<Point2D>         samples;

Point2D被定义为类

在编译期间,我得到了很多错误(C2143、C4430和C2238)

有什么想法吗?

除非在代码的其他部分定义名称空间,否则需要使用std::vector

#include <vector>
#include <math.h>
...
std::vector<Point2D> samples;

您需要链接到标准Vector。std::vector