在C ++头文件中声明向量 [英] Declaring vectors in a C++ header file
本文介绍了在C ++头文件中声明向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的C ++类的头文件中的向量声明有些麻烦。我的整个头文件如下所示:
I am having some trouble with vector declarations in the header file of a C++ class I am making. My entire header file looks like this:
#ifndef PERSON_H
#define PERSON_H
#include "Message.h"
#include <string>
#include <vector>
class Person {
public:
Person() {};
Person(std::string emailAddress);
private:
vector<Message> inbox;
vector<std::string> contacts;
std::string emailAddress;
};
#endif PERSON_H
我的错误发生在 声明(我声明我的向量)。我收到的错误是C4430 - 缺少类型说明符和C2238 - 意想不到的令牌前面';'
My error occurs on the lines following the "private" declaration (where I declare my vectors). The error I am getting is C4430 - missing type specifier and and C2238 - unexpected tokens preceding ';'
感谢您的帮助。
推荐答案
您缺少命名空间:
std::vector
这篇关于在C ++头文件中声明向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文