Page 1 of 1

Unreal 3.2.1 Win32 Build Problems - type redefinition errors

Posted: Fri Jul 09, 2004 7:42 pm
by rocafella
When compiling UnrealIRCd 3.2.1, with openssl enabled, under Windows (using Visual Studio 2003), I recieve the following errors:

Code: Select all

cl /MD /O2 /G5 /I ""D:\Development\LibCurl\include"" /I ""D:\Development\ZLib"" /I ""D:\Development\OpenSSL\include"" /J /I ./INCLUDE /Fosrc/ /nologo  /D ZIP_LINKS /D ZLIB_DLL /D USE_LIBCURL /D FD_SETSIZE=16384 /D USE_SSL  /D NOSPOOF=1 /c src/ircd.c
ircd.c
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock2.h(109) : error C2011: 'fd_set' : 'struct' type redefinition
        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h(54) : see declaration of 'fd_set'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock2.h(144) : warning C4005: 'FD_SET' : macro redefinition
        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h(88) : see previous definition of 'FD_SET'

...
Following this is dozens of "type redefinition" errors of various structs. Any ideas on how to resolve this issue?

Thanks for your time. :)

Posted: Fri Jul 09, 2004 8:27 pm
by Syzop
Actually *IIRC* this is due to curl.

Posted: Fri Jul 09, 2004 10:23 pm
by codemastr
Yeah, did you install libcurl as well?

Posted: Sat Jul 10, 2004 1:57 am
by aquanight
Actually I had this same problem.

And fixed it.

How? Pull up your favorite text editor. Navigate to your Platform SDK Include folder. Open winsock2.h.

After the huge comment at the beginning, add:

#ifndef _WINSOCKAPI_ /* HACK: Prevent inclusion of WS2 if WS1 is already here. */

Then go down to the end of the file and add:

#endif /* _WINSOCKAPI_ */

My analysis was that for some reason winsock.h was being included, followed by winsock2.h. Ideally, winsock2.h would be included first, which would prevent winsock.h from causing errors if it were included later. But when it is the other way around, errors such as this can occur :P . By adding these lines, winsock2.h will check if winsock.h was already included, and if so, will not define anything :P .

*edit* The only reason I'm suggesting it is because it's probably something M$ should've had anyway :P */edit*

my solution

Posted: Sat Jul 10, 2004 2:05 am
by fez
my solution was to go to the curl directory, and open include/curl/multi.h
and change line 55

#include <winsock2.h>

to

#include <winsock.h>

that fixes it.


-- fez

Posted: Sun Jul 11, 2004 4:08 am
by rocafella
codemastr: Yes, I did install libcurl.

fez: Thank you, this worked perfectly.

Perhaps add this note to the compiling_win32.txt guide, in case someone else runs into trouble? :)

Thank for the help.

Posted: Sun Jul 11, 2004 10:39 am
by Shane
i got the same problem but my stupid step was put away libcurl -.-"
thank u all above~