Compiling errors after declaring instance of class

Compiler: VC++ '08
OS: Windows 7 Starter Edition

I am trying to create a sort of text RPG, but I haven't programmed in a few weeks, and am not sure why I get the errors. I define the class and all the variables within the class, then try to create an instance of it, but the compiler vehemently protests my doing so.

Update:
I added

char words;

before

int input

I also added a semicolon after input and changed

cin >> input;

to

cin >> words;

Now I have six error messages. Well, that's one less than seven.


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
#include <iostream>

using namespace std;

int main()
{
	char words;
        int input;
	class thing
	{
	public:
		int STR;
		int DEX;
		int CON;
		int INT;
		int WIS;
		int CHA;
		int HP;
		int AC;
		int name;
	private:

	}

	thing player;

	cout << "Enter your name:\n";
	cin >>words;
	words = player.name;
	cout << player.name;
	cin.get();
}


1
2
3
4
5
6
7
8
9
10
11
12
13
1
1>Compiling...
1>main.cpp
1>c:\users\noahpocalypse\documents\visual studio 2008\projects\proto_rpg\proto_rpg\main.cpp(26) : error C2146: syntax error : missing ';' before identifier 'player'
1>c:\users\noahpocalypse\documents\visual studio 2008\projects\proto_rpg\proto_rpg\main.cpp(26) : error C2065: 'player' : undeclared identifier
1>c:\users\noahpocalypse\documents\visual studio 2008\projects\proto_rpg\proto_rpg\main.cpp(30) : error C2065: 'player' : undeclared identifier
1>c:\users\noahpocalypse\documents\visual studio 2008\projects\proto_rpg\proto_rpg\main.cpp(30) : error C2228: left of '.name' must have class/struct/union
1>        type is ''unknown-type''
1>c:\users\noahpocalypse\documents\visual studio 2008\projects\proto_rpg\proto_rpg\main.cpp(31) : error C2065: 'player' : undeclared identifier
1>c:\users\noahpocalypse\documents\visual studio 2008\projects\proto_rpg\proto_rpg\main.cpp(31) : error C2228: left of '.name' must have class/struct/union
1>        type is ''unknown-type''
1>Build log was saved at "file://c:\Users\noahpocalypse\Documents\Visual Studio 2008\Projects\proto_rpg\proto_rpg\Debug\BuildLog.htm"
1>proto_rpg - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited on
Class definitions must be terminated with a semicolon (line 23).
Last edited on
Topic archived. No new replies allowed.