Permalink
Browse files

fix mingw compile error (#54)

* Update tcp_socket.cpp

* Update windows_tcp_socket.cpp

* fix mingw compile error
  • Loading branch information...
kevin1018 authored and Cylix committed Sep 10, 2018
1 parent 17d6a6f commit 5b60d9a9e87aa4ba8118a66f6d65eb15ab0c8769
Showing with 34 additions and 6 deletions.
  1. +2 −2 CMakeLists.txt
  2. +16 −2 sources/network/common/tcp_socket.cpp
  3. +16 −2 sources/network/windows/windows_tcp_socket.cpp
View
@@ -44,7 +44,7 @@ project(${PROJECT} CXX)
###
# compilation options
###
IF (WIN32)
IF (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /O2 /bigobj")
# was causing conflics with gtest build
@@ -70,7 +70,7 @@ IF (WIN32)
add_definitions(-DWIN32_LEAN_AND_MEAN)
ELSE ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -W -Wall -Wextra -O3")
ENDIF (WIN32)
ENDIF (MSVC)
###
@@ -25,8 +25,22 @@
#include <tacopie/utils/logger.hpp>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef __GNUC__
# include <Ws2tcpip.h> // Mingw / gcc on windows
#define _WIN32_WINNT 0x0501
#include <winsock2.h>
# include <Ws2tcpip.h>
extern "C" {
WINSOCK_API_LINKAGE INT WSAAPI inet_pton( INT Family, PCSTR pszAddrString, PVOID pAddrBuf);
WINSOCK_API_LINKAGE PCSTR WSAAPI inet_ntop(INT Family, PVOID pAddr, PSTR pStringBuf, size_t StringBufSize);
}
#else
// Windows...
#include <winsock2.h>
#include <In6addr.h>
#include <Ws2tcpip.h>
#endif
#else
#include <arpa/inet.h>
#include <fcntl.h>
@@ -34,8 +34,22 @@
#include <cstring>
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef __GNUC__
# include <Ws2tcpip.h> // Mingw / gcc on windows
#define _WIN32_WINNT 0x0501
#include <winsock2.h>
# include <Ws2tcpip.h>
extern "C" {
WINSOCK_API_LINKAGE INT WSAAPI inet_pton( INT Family, PCSTR pszAddrString, PVOID pAddrBuf);
WINSOCK_API_LINKAGE PCSTR WSAAPI inet_ntop(INT Family, PVOID pAddr, PSTR pStringBuf, size_t StringBufSize);
}
#else
// Windows...
#include <winsock2.h>
#include <In6addr.h>
#include <Ws2tcpip.h>
#endif
namespace tacopie {

0 comments on commit 5b60d9a

Please sign in to comment.