compiler problem in codeBlocks

I'm writing my first c++ program that uses multiple files. I'm using codeBlocks. I've run into an issue that I haven't had in the past. When I try to build and run I'm getting an error message. it says: "use of undeclared identifier 'std'. The error is coming from a header file, where std is used (see code below). I've not had this problem before, and I suspect if may have to do with compiler settings, or something to do with how I set up project.

Any hints would be appreciated. Thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
//  Book.h

#ifndef examples_Book_h
#define examples_Book_h

class Patron;

enum Locale {ON_SHELF, ON_HOLD, CHECKED_OUT};

class Book
{
private:
    std::string idCode;
    std::string title;
    std::string author;
    Locale location;
    Patron* checkedOutBy;
    Patron* requestedBy;
    int dateCheckedOut;

public:
    static const int CHECK_OUT_LENGTH = 21;
    Book();
    Book(std::string idc, std::string t, std::string a);
    int getCheckOutLength();
    std::string getIdCode();
    std::string getTitle();
    std::string getAuthor();
    Locale getLocation();
    void setLocation(Locale lo);
    Patron* getCheckedOutBy();
    void setCheckedOutBy(Patron* p);
    Patron* getRequestedBy();
    void setRequestedBy(Patron* p);
    int getDateCheckedOut();
    void setDateCheckedOut(int d);
};

#endif
hi,

Try this:

#include <string>

One must include any file that is required for anything (classes, algorithms etc)that is used in your file.

Hope all goes well :+)
Thanks. That worked!
Topic archived. No new replies allowed.