cURL / Mailing Lists / curl-library / Single Mail


RE: libcurl 7.17.1 'socklen_t' undefined compile error VisualStudio2005

From: Max L. Eidswick <>
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

//#include <windows.h>
//#include <winsock2.h>
#include <ws2tcpip.h>
#define socklen_t int
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,


-----Original Message-----
From: [] 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.

#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
struct test3 {
  int a_i_3;
  socklen_t a_s_3;

Received on 2007-11-21