Declaring Strings/Class trouble

Good day internet forum browsers!

I have a dilemma here, quiet embarrassing since I've been programming in c/c++ for a good couple of years now. I just started up again and I decided to goof around and make a text base game, and I'm making a class for it since its an interesting concept and I might just turn it into a windows program later on.

k here's the problem - I declare a string, a simple task, or so I thought, but I've been plagued with this error

31 C:\Dev-Cpp\game.h `string' does not name a type

Past experiences I haven't ever had to give a string a type, but I tried to appease the compiler to no avail. Any help in the right direction here would be awesome.

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
#include <iostream>
#include <string.h>
#ifndef GAME_H
#define GAME_H

/*
 * No description
 */
class Game
{    
	public:
		// class constructor
		Game();  
        
    
		// class destructor
		~Game();
	private:
            string names;
            double EXP;
            int LEVEL;
    
};

#endif // GAME_H 


Also having this error in the implementation file

3 C:\Dev-Cpp\game.cpp In file included from game.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14

#include "game.h" // class's header file

// class constructor
Game::Game()
{
	// insert your code here
}
  
// class destructor
Game::~Game()
{
	// insert your code here
}


Most of this is Pseudo code, but it should all compile with no problem.
You have not included the <string> header. Also, i'm not used to writing programs with multiple files (.cpp and .h) but you may need to write std::string names as you are not using namespace std; anywhere - althouygh i'm not saying i'm advising you to do this.
String is with a capital lettre
Thank you sir, I forgot to include the using namespace std since I had started the main program before the class its going to use was finished, and got sloppy. As for the <string> header I thought <string.h> were 1 in the same, but thanks it was corrected.
Topic archived. No new replies allowed.