cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl 7.17.1 'socklen_t' undefined compile error VisualStudio2005

From: Yang Tse <yangsita_at_gmail.com>
Date: Thu, 22 Nov 2007 02:58:10 +0100

2007/11/21, Max L. Eidswick wrote:

> Hi, Yang -- OK, I am moving forward again. I had to put the winsock2.h
> before windows.h.

Amazing!

I think you might have a problem somewhere in the VS2005 or PSDK
installation or configuration.

Are you creating a new empty project with the wizard or just copying
over another one and just removing everything ? The snippets I've
posted were only intended to try to diagnose the initial problem you
had.

Are you using precompiled headers ? Have you 'cleaned' between builds
? If it actually is a new and clean project winsock.h should not be
pulled in.

> The following works:
>
> ----- snip
>
> #ifndef WIN32_LEAN_AND_MEAN
> #define WIN32_LEAN_AND_MEAN
> #endif
> //#include <windows.h>
> //#include <winsock2.h>
> #include <ws2tcpip.h>
> #ifndef INET_ADDRSTRLEN
> #define socklen_t int
> #endif
> struct test2 {
> int a_i_2;
> socklen_t a_s_2;
> };
> #include <curl/curl.h>
>
> ----- end snip
>
> I am now including the curl.h header and it compiles ok. I will get on with the project.

If you're happy with it, and it allows you to work on your project,
you're free to use it. But when curl.h gets changed you might also
need to change something.

> Are there any other obvious Windows
> problems (like runtime libraries, etc.) that I should look out for?

Read docs/INSTALL section Win32 (line 145 onwards).

-- 
-=[Yang]=-
Received on 2007-11-22