0
我的头文件有问题。 由于某些原因,它给了我关于字符串的错误。 在Header.h我C++错误中的字符串C2061
#include <string>
#ifndef HEADER_H
#define HEADER_H
class Player
{
public:
string firstName;
string lastName;
int birthYear;
string *matchDates;
string toString();
void addMatchDate(string date);
Player();
Player(string firstName, string lastName, int birthYear);
~Player();
};
#endif
但上帝知道什么原因,它给了我一堆错误。 这些都是一些错误的:
Error C2146: syntax error : missing ';' before identifier 'firstName' Error C2146: syntax error : missing ';' before identifier 'lastName' Error C2061: syntax error : identifier 'string'
任何想法如何解决这个问题?
使用限定名('string'在命名空间'std'中定义):'std :: string'。 – hmjd
哦,所以我可以添加命名空间标准? – Snigelmat
请参阅http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice – hmjd