String type not recognized

1
2
3
4
5
6
7
8
9
10
11
12
13
class question
{
    private:
    std::string question;
    std::string option[4];
    int corr_op;
    public:
    void cons_in();
    void cons_out();
    void file_in();
    void file_out();
    int check(int);
};

When I put this in the main file, it works correctly but whenever I try to use a header file.....it says that 'string in namespace std does not name a type'.
#include <string>
Same error as before..
You're including your headers in the wrong order.

#include <string> needs to come before whatever header file this question class is in.

Or better yet, you should #include <string> inside of question's header file.

See section 4: http://cplusplus.com/forum/articles/10627/
Topic archived. No new replies allowed.