This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Error compiling code using winsock functions
- From: "Sisyphus" <kalinabears at iinet dot net dot au>
- To: "David None" <davoooooo at hotmail dot com>,<gcc-help at gcc dot gnu dot org>
- Date: Sun, 6 Jul 2003 13:13:52 +1000
- Subject: Re: Error compiling code using winsock functions
- References: <Law11-F75ErPn2EV9tb0006e6a7@hotmail.com>
----- Original Message -----
From: "David None" <davoooooo@hotmail.com>
>
> Basically, when compiling with cygwin with the following command:
> gcc iphdrinc.c -o iphdrinc.exe -lwsock32
>
> I get the following error:
> "iphdrinc.o(.text+0x820):iphdrinc.c: undefined reference to
'_WSASocketA@24'
> collect2: ld returned 1 exit status"
>
Maybe there's an additional lib you also need to link to. In my msvc
compiler it looks like that "reference" is "defined" in WS2_32.lib, not
wsock32.lib.
So, if you have something like a 'libws2_32.a' try lnking to it as well.
You could also try searching the libs for the text string "WSASocketA" to
find out which additional library file needs to be linked in.
Cheers,
Rob