Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't include the <string> header

Tags:

c++

include

I have the following #include in my program which I am trying to change from a console app to a GUI app. I have to code this by hand. The problem is my program can't import the string header. Why is that?

#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_ */

ERROR:

Description Resource    Path    Location    Type
Type 'string' could not be resolved Catalog.h   /L_6-8_GUI  line 25 Semantic Error

PS: I use Eclipse with the QT addon.

like image 535
Bogdan M. Avatar asked Jul 07 '26 18:07

Bogdan M.


1 Answers

write std::string, not just string.

like image 193
Cheers and hth. - Alf Avatar answered Jul 10 '26 08:07

Cheers and hth. - Alf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!