C++ Can';t包括<;字符串>;标题
我的程序中有以下C++ Can';t包括<;字符串>;标题,c++,include,C++,Include,我的程序中有以下#include,我正试图将其从控制台应用程序更改为GUI应用程序。我必须手工编写代码。问题是我的程序无法导入字符串头。为什么呢 #ifndef CATALOG_H_ #define CATALOG_H_ #include <string> #include "StudentRepository.h" #include "Student.h" using namespace std; class Catalog{ private: StudentR
#include
,我正试图将其从控制台应用程序更改为GUI应用程序。我必须手工编写代码。问题是我的程序无法导入字符串头。为什么呢
#ifndef CATALOG_H_
#define CATALOG_H_
#include <string>
#include "StudentRepository.h"
#include "Student.h"
using namespace std;
class Catalog{
private:
StudentRepository *studRepo;
public:
Catalog(StudentRepository *stre):studRepo(stre){};
~Catalog();
void addNewStudent(string name, int id, int group);
void removeStudent(string name);
void editStudent(string,int,int);
Student seachStudent(string name);
void printStudents();
.
.
.
};
#endif /* CATALOG_H_ */
PS:我将Eclipse与QT插件一起使用。写
std::string
,而不仅仅是string
有什么问题?您是否将其包含在程序中,但没有获得库函数?您的问题与Qt:removed标记无关。@user1388172:Post错误消息。错误消息很重要,所以“忘记”发布准确的错误消息是一个非常糟糕的主意头文件中的代码>。它将导入命名空间std中截至该点的所有符号,而您永远不知道这些符号是什么(因为标准将被更新,并且因为标准没有定义哪些标准头包含哪些头)。我曾经有过一段关于遗留代码的真实经历,一旦我切换到更新的编译器版本,这些代码就停止了编译。不仅导入了标准符号,还导入了非标准符号。eclipse中的包含路径是否正确?它们可能是在QT(我指的是IDE)中正确设置的,而不是在Eclipse中。
Description Resource Path Location Type
Type 'string' could not be resolved Catalog.h /L_6-8_GUI line 25 Semantic Error