www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: Re: Compile error in examples under MinGW

Re: Compile error in examples under MinGW

From: Peter Stuge <peter_at_stuge.se>
Date: Sat, 11 Dec 2010 21:10:01 +0100

Daniel Stenberg wrote:
>> ../include/libssh2.h:134:16: error: expected '=', ',', ';', 'asm' or
>> '__attribute__' before 'libssh2_socket_t'
>
> I don't use windows so I've not seen this. Does this happen because the
> windows.h and family headers are included after and not before libssh.h?

Yeah. I'm inclined to stuff the unix socket headers into libssh2.h
too. What do you think? And Luis, does applying the below patch fix
your problem? Please confirm.

diff --git a/include/libssh2.h b/include/libssh2.h
index e011d49..17bb208 100644
--- a/include/libssh2.h
+++ b/include/libssh2.h
@@ -93,6 +93,25 @@ extern "C" {
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#ifdef WIN32
+#include <windows.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#endif
+
 /* Allow alternate API prefix from CFLAGS or calling app */
 #ifndef LIBSSH2_API
 # ifdef LIBSSH2_WIN32

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-12-11

the libssh2 team