On 1/26/2010 21:50, Chris Spencer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> I'm having a bit of a problem with my networking code. Specifically, the
> linker can't find gai_strerror().
>
> To provide a very simple test case:
>
> #include<ws2tcpip.h>
> int main() {
> gai_strerror(0);
> return 0;
> }
>
> This compiles without issue in mingw32, but with mingw64 it fails:
>
> $ mingw32-gcc test.c
> $ x86_64-w64-mingw32-gcc test.c
> /tmp/ccfVhfda.o:test.c:(.text+0x13): undefined reference to `_gai_strerrorA'
> collect2: ld returned 1 exit status
>
> I can't really figure out what's going on here since it's defined inline
> in the header:
>
> WS2TCPIP_INLINE char *gai_strerrorA(int ecode) { ... }
>
> Any ideas?
>
> $ x86_64-w64-mingw32-gcc --version
> x86_64-w64-mingw32-gcc (Gentoo 4.4.0_alpha20090331, pie-10.1.3)
> 4.4.0-alpha20090331 20090331 (prerelease)
>
> Cheers, Chris.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkte8zEACgkQ6iqRtkAADZgPMgCg4KZfVCawUn6gZztxsjK+43aH
> eMsAnj6sLwQx8Tg2XaaImnNeZvcBZGTk
> =T9Yj
> -----END PGP SIGNATURE-----
>
Hi,
you forgot to add -lws2_32, "x86_64-w64-mingw32-gcc test.c -lws2_32".
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public