error C2011 while compiling class

I have been working on our new assignment, which is a statistics class. I had the header and implementation files all written and could not get them to compile, I kept getting:
error C2011: 'stat' : 'struct' type redefinition
Which I found out means that the class definition was read twice, like maybe the header was being read in more than once. I used a macro guard, checked everything multiple times, and then in frustration, created a new cpp, and stripped everything out of the files and just tried to compile this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;

class stat
{
public:
	stat(int len);	
private:
	int length;
}


stat::stat(int len)
{
	length = len;
	return;
}


int main()
{
	stat test;
	return;
}

I'm still getting the same error. It has to be something really silly that I'm not seeing since I've been staring at it for hours. Any suggestions?
'stat' is the name of a class defined in the standard header wchar.h.
haaaa!
whar.h came up in some of the many error messages, I even Googled it, I just didn't make the connection.
I should've figured that one out for myself, thanks so much.
And you're missing the ; after the class definition. Also, return 0 in main.
Once I changed the classname to statistics, I was able to complete the rest of the project with no problems(other than a few simple syntax errors).
Someone else in my class was having the same problem, and when I told him to change the class name, he said: "I didn't #include wchar.h, so it shouldn't cause any problems".
I am guessing that maybe wchar is included when you use iostream, but I'm just guessing.
I went into my include dir, opened iostream, and searched for wchar, it wasn't there.
How is wchar.h being included in my project?
It's included in some file included by some file [...] included by iostream. I can't find where, really.
Last edited on
Topic archived. No new replies allowed.