Error C2011 in Visual C++ 6.0 ('struct' type redefinition)
Posted on 2004-04-13
I'm trying to write a small program that will "ping" in a Windows environemnt using rawping.
When I try to build the project I get the error messages:
c:\ folder\subfolder\project name\rawping.h (line number) : error C2011: 'IPHeader' : 'struct' type redefinition
c:\folder\subfolder\project name\rawping.h (line number) : error C2011: 'ICMPHeader' :'struct' type
I haven't been able to find much information about error C2011 . I understand that a structure is the same as a class except that its members are public by default.
I am assuming that a 'struct' can be defined only once but not sure when / where it is defined.
Both 'IPHeader' and 'ICMPHeader' appear in 3 different files: rawping.cpp, rawping.h and rawping_driver.cpp .
My questions: assuming a 'struct' can be defined only once, when/where should it be defined?
(as the error appears in the header file, I'm guessing the compiler found the 'struct' in one of the .cpp files)
What other references to IPHeader and ICMPHeader need to be removed?
Any help will be appreciated.