libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] compile problem on Visual Studio 2010


From: Jed Irvine
Subject: [libmicrohttpd] compile problem on Visual Studio 2010
Date: Fri, 16 Dec 2011 16:49:11 -0800

This is my first time trying to integrate a third party library into a C++ project, so I may be stuck on something basic.  For now I'm just trying to get the hellobrowser.c example from the tutorial to build.

I'm using Visual Studio 2010 and trying to hook in libmicrohttpd-0.9.17-w32.

Here's what I did so far:
- put the libmicrohttpd-0.9.17-w32 directory in the same directory as the sln
-in properties, under C/C++ additional include directories, added :

C:\Documents and Settings\admin-jed\My Documents\Visual Studio 2010\Projects\mhdTest2\libmicrohttpd-0.9.17-w32\include

-in properties, under Linker additional library directories added

C:\Documents and Settings\admin-jed\My Documents\Visual Studio 2010\Projects\mhdTest2\libmicrohttpd-0.9.17-w32\lib (where sits the .dll.a, .a , and .la files

I removed these includes:

#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>

...and added a .h file, jed_platform.h,  that tried to address finding/defining these (after googling a bunch to find where these live on windows):

"...size_t, fd_set, socklen_t and struct sockaddr data types and define MHD_PLATFORM_H..."

...the best I could figure is this:

#ifndef MHD_PLATFORM_H
#define MHD_PLATFORM_H
#include <WS2tcpip.h>
#include <BaseTsd.h>
#include <winsock2.h>
#endif


So in my hellobrowser.c, I have this

#include "jed_platform.h"
#include "microhttpd.h"

as the new includes.  With this arrangement, many basic types are not found, even though I understand they live in BaseTsd.h, for example, ssize_t.

If I add explicit typedefs (which I know I shouldn't do) like this:

typedef unsigned int     size_t; //assumes 32 bit
typedef int              ssize_t; //assumes 32 bit

...then the ssize_t compile problem goes away.

Interestingly, when I guard those statements like this:

#ifndef _SIZE_T_DEFINED
typedef unsigned int     size_t; //assumes 32 bit
typedef int              ssize_t; //assumes 32 bit
#define _SIZE_T_DEFINED 5
#endif

Then the problems return, suggesting that something is #defining _SIZE_T_DEFINED, yet the related types are not available to the compile.  This has me quite confused, though this would not be the first time.

Any help would be greatly appreciated!

Thanks,

Jed


reply via email to

[Prev in Thread] Current Thread [Next in Thread]