cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: libcurl 7.17.1 'socklen_t' undefined compile error VisualStudio2005

From: Max L. Eidswick <max_at_eidswick.com>
Date: Wed, 21 Nov 2007 13:08:38 -0700

Hi, Yang -- OK, I am moving forward again. I had to put the winsock2.h before windows.h. 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. Are there any other obvious Windows
problems (like runtime libraries, etc.) that I should look out for?

Thanks, again,

Max

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Yang Tse
Sent: Wednesday, November 21, 2007 12:52 PM
To: libcurl development
Subject: Re: libcurl 7.17.1 'socklen_t' undefined compile error VisualStudio2005

> ------ Build started: Project: RedPawComms, Configuration: Debug Win32 ------
> Compiling...
> RedPawComms.c
> c:\program files\microsoft visual studio 8\vc\platformsdk\include\winsock2.h(112) : error C2011: 'fd_set' : 'struct' type
> redefinition
> c:\program files\microsoft visual studio 8\vc\platformsdk\include\winsock.h(54) : see declaration of 'fd_set'

Somehow you are including winsock.h besides winsock2.h You can't do
that. It won't work.

Test the following before trying test2 even if test1 fails.

/*---8<-----8<-----8<-----8<-----8<--/
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
struct test3 {
  int a_i_3;
  socklen_t a_s_3;
};
/*---8<-----8<-----8<-----8<-----8<--/

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