error C2011 : 'struct' type redefinition

Hi, I'm trying to compile someone else's code. The problem is, he used gcc to compile, but I need to compile it with visual c++ 2003 (I need to include the code in some other project). When compiling, I get multiple error C2011: StructName: 'struct' type redefinition.
From what I can gather, this would happen if the compiler tried to include the same file multiple times. However, there is the classic
#ifndef _FILENAME 
#define _FILENAME
//code here

tag around the code where the problematic struct can be found. From what I understand, with such a tag, the code shouldn't be included more than once, so why do I get that error?
Last edited on
It's probably not related to that, then. Can you show us the rest of your code?

Maybe you have the same problem as this person. In the first result when I Google "'struct' type redefinition", the victim is trying to compile a program that works in gcc but not visual c++. The solution:
"Visual C++ seems to have a problem with #include<iostream.h> but instead will only allow me #include<iostream>"

Tell us: are you including <iostream.h>? That may be the problem.
Last edited on
I can't show the rest of the code because it's incredibly large and I have no idea where the problem is (as I said, it's not my code), so I can't really show you just the relevent part.
I'll check though, I think I've seen some "include <somefile.h>" in there. I'll see if it fixes the problem.

-=edit=- there were no <iostream.h>, but when looking at the many errors I had other than the one mentioned earlier (I initially ignored them, since most seemed to spawn from the first error), I found that there is a #include <values.h> and visual c++ can't find that file... Why is that?
Last edited on
I don't think values.h is a standard file...but you might also want to check if you are including the same file multiple times, because that might cause the error.
Topic archived. No new replies allowed.