This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error compiling code using winsock functions


----- 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]