Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

winsock compile crash

2 views
Skip to first unread message

ioil

unread,
Jun 17, 2010, 1:20:27 AM6/17/10
to
The following errors are from a file with just windows and winsock2
included.


C:\Users\ioil\Desktop\dm\bin>dmc sockit.c
typedef struct fd_set {
^
C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(85) : Error:
'fd_set' is already defined
} fd_set;
^
C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(88) : Error:
identifier or '( declarator )' expected
struct timeval {
^
C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(129) : Error:
'timeval' is already defined
};
^
C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(132) : Error:
identifier or '( declarator )' expected
struct hostent {
^
C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(185) : Error:
'hostent' is already defined
Fatal error: too many errors
--- errorlevel 1

C:\Users\ioil\Desktop\dm\bin>


What's already been tried : placing the winsock.dll file in the same
directory as the compiler and program to be compiled, placing it in
the system32 directory, and entering it in the registry with the
regsrv32 command. Don't really know where to go from here, appreciate
any advice . . .

Ulrich Eckhardt

unread,
Jun 17, 2010, 4:44:08 AM6/17/10
to
ioil wrote:
> The following errors are from a file with just windows and winsock2
> included.

Stupid as it is, you have to include winsock2.h before windows.h. Also make
sure other headers don't include windows.h indirectly before winsock2.h.

> C:\Users\ioil\Desktop\dm\bin>dmc sockit.c
> typedef struct fd_set {

Wait: Is that a line of your file or does it point to the WinSock header?


> What's already been tried : placing the winsock.dll file in the same
> directory as the compiler and program to be compiled, placing it in
> the system32 directory, and entering it in the registry with the
> regsrv32 command.

This is a compiler error, at the stage where your program is translated into
machine code. The next step would be linking it into an executable. The
last step is loading the program into a process and executing it, which is
the place where DLLs come into the game.

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

ioil

unread,
Jun 18, 2010, 4:44:21 AM6/18/10
to

Dear Uli,

Wow, changing the order of the includes fixed it, brilliant, thank you
very much.

ioil

0 new messages