Archived

This topic is now archived and is closed to further replies.

Convict@Large

Error C2011 and #ifndef

Recommended Posts

Ok I have the usual include guards in all my header files in my project: #ifndef _FILENAME_H_ #define _FILENAME_H_ // code #endif But I am still getting C2011 ''type redefinition'' errors and C4005 ''macro redefinition'' warnings in winsock2.h but the weird thing is that winsock2.h has not been modififed by me and contains its own include guards as well!! Anyone have any ideas as to what could casue this? As I have no ideas... And I have double checked all my header files and they do use include guards... Cheers, Convict@Large "I code therefore I am" Anon

Share this post


Link to post
Share on other sites
I can include winsock2.h first in the header file it is in, but that seems to makes no difference still getting same number of errors...

AHA!!! found the problem, I was including winsock2.h and in another file that includes the file that includes winsock2.h, windows.h was being included, after looking in windows.h it includes winsock.h as well that must be where the error was coming from. Winsock2.h also appears to pull in windows.h if its not #defined. That is good to know that in the future if I use winsock2.h I do not appear to need windows.h as well...

Would be nice if that could have been mentioned in MSDN.

Cheers,

Convict@Large

"I code therefore I am" Anon

[edited by - convict@large on April 29, 2002 8:18:35 AM]

Share this post


Link to post
Share on other sites