0

我在一个非常简单的标题中收到 C2143 错误。你能帮我找出问题所在吗?

#ifndef GLOB_H_INCLUDED
#define GLOB_H_INCLUDED
#include <string>
#include <windows.h>

 extern string *name, *surname, *dob, *hospNo, *addr, *sex, *email, *phone, *nhs, *allerg, *indic, *notes;
 extern int leftc, rightc, middlec;
 extern string ks;

#endif

如果您需要任何进一步的解释......在此先感谢。

4

2 回答 2

1

尝试using namespace std;在字符串头的包含之后添加:)

于 2013-03-12T19:43:29.940 回答
0

您缺少“std”命名空间 - 但不是在头文件中添加“using”子句(这是不好的做法),而是像这样限定您的名称:

#ifndef GLOB_H_INCLUDED
#define GLOB_H_INCLUDED
#include <string>
#include <windows.h>

extern std::string *name, *surname, *dob, *hospNo, *addr, *sex, *email, *phone, *nhs, *allerg, *indic, *notes;
extern int leftc, rightc, middlec;
extern std::string ks;

#endif
于 2013-03-13T11:35:10.710 回答