diff --git a/Makefile b/Makefile index 5b02e42..f15a330 100644 --- a/Makefile +++ b/Makefile @@ -352,8 +352,8 @@ intercept: $(ZT_INCLUDES) examples/intercept/intercept.cpp -D_GNU_SOURCE \ -shared -o $(BUILD)/intercept.so $< -ldl simple: - $(CXX) $(CXXFLAGS) $(SANFLAGS) $(LIBZT_INCLUDES) $(LIBZT_DEFS) examples/bindings/cpp/simple_client_server/client.cpp -o $(BUILD)/client -L$(BUILD) -lzt - $(CXX) $(CXXFLAGS) $(SANFLAGS) $(LIBZT_INCLUDES) $(LIBZT_DEFS) examples/bindings/cpp/simple_client_server/server.cpp -o $(BUILD)/server -L$(BUILD) -lzt + $(CXX) $(CXXFLAGS) $(SANFLAGS) $(LIBZT_INCLUDES) $(LIBZT_DEFS) examples/bindings/cpp/simple_client_server/client.cpp -o $(BUILD)/client -L$(BUILD) -lzt $(WINDEFS) + $(CXX) $(CXXFLAGS) $(SANFLAGS) $(LIBZT_INCLUDES) $(LIBZT_DEFS) examples/bindings/cpp/simple_client_server/server.cpp -o $(BUILD)/server -L$(BUILD) -lzt $(WINDEFS) dlltest: $(CXX) $(CXXFLAGS) diff --git a/examples/bindings/cpp/simple_client_server/client.cpp b/examples/bindings/cpp/simple_client_server/client.cpp index c6b8069..928d5ca 100644 --- a/examples/bindings/cpp/simple_client_server/client.cpp +++ b/examples/bindings/cpp/simple_client_server/client.cpp @@ -1,12 +1,19 @@ #include #include -#include -#include -#include #include #include + +#if defined(__linux__) || defined(__APPLE__) #include +#include #include +#include +#endif + +#if defined(__MINGW32__) || defined(__MINGW64__) +#include +#include +#endif #include "libzt.h" diff --git a/examples/bindings/cpp/simple_client_server/server.cpp b/examples/bindings/cpp/simple_client_server/server.cpp index f932918..7967da2 100644 --- a/examples/bindings/cpp/simple_client_server/server.cpp +++ b/examples/bindings/cpp/simple_client_server/server.cpp @@ -1,13 +1,20 @@ #include #include -#include -#include -#include #include -#include -#include #include +#if defined(__linux__) || defined(__APPLE__) +#include +#include +#include +#include +#endif + +#if defined(__MINGW32__) || defined(__MINGW64__) +#include +#include +#endif + #include "libzt.h" int main(int argc, char **argv) diff --git a/include/libzt.h b/include/libzt.h index 7c0d290..022b143 100644 --- a/include/libzt.h +++ b/include/libzt.h @@ -34,7 +34,20 @@ #define LIBZT_H #include "libztDebug.h" -#include "sys/socket.h" + +#include +#include + +#if defined(__linux__) || defined(__APPLE__) +#include +#endif + +#if defined(__MINGW32__) || defined(__MINGW64__) +#include +#include +#include +int inet_pton(int af, const char *src, void *dst); +#endif /****************************************************************************/ /* DLL export for Windows (and other cruft) */ @@ -44,9 +57,6 @@ typedef int ssize_t; #endif -#include -#include - #if defined(__MING32__) || defined(__MING64__) #ifdef ADD_EXPORTS #define ZT_SOCKET_API __declspec(dllexport) diff --git a/src/SysUtils.cpp b/src/SysUtils.cpp index ffd3dcf..93155a3 100644 --- a/src/SysUtils.cpp +++ b/src/SysUtils.cpp @@ -41,7 +41,9 @@ #include #endif +#if defined(__linux__) || defined(__APPLE__) #include +#endif #include "SysUtils.h" #include diff --git a/src/Utilities.cpp b/src/Utilities.cpp index e0d95f1..022481a 100644 --- a/src/Utilities.cpp +++ b/src/Utilities.cpp @@ -30,10 +30,13 @@ * Misc utilities */ -//#include "libztDebug.h" #include "Utilities.h" -#if defined(__MINGW32__) +#if defined(__MINGW32__) || defined(__MINGW64__) + +#include +#include +#include int inet_pton4(const char *src, void *dst) { diff --git a/src/libzt.cpp b/src/libzt.cpp index cfe6a34..f41df17 100644 --- a/src/libzt.cpp +++ b/src/libzt.cpp @@ -49,7 +49,6 @@ #include "libztDebug.h" #include -//void * memcpy(void * dst, const void * src, size_t n); #ifdef __cplusplus extern "C" { diff --git a/test/selftest.cpp b/test/selftest.cpp index c3274fa..7705cfd 100644 --- a/test/selftest.cpp +++ b/test/selftest.cpp @@ -24,20 +24,27 @@ * of your own application. */ -#include +#if defined(__linux__) || defined(__APPLE__) #include #include -#include -#include #include #include #include +#include +#endif + +#if defined(__MINGW32__) || defined(__MINGW64__) +#include +#include +#endif + +#include +#include #include #include #include #include #include -#include #include #include #include