Permalink
Browse files

fix complie error in msvc

  • Loading branch information...
1 parent a1c84f7 commit 4a8b8054f5b5b3693864c98d8fcfe648d986453c @yajiedesign yajiedesign committed Mar 16, 2016
Showing with 6 additions and 4 deletions.
  1. +1 −0 CMakeLists.txt
  2. +0 −3 cmake/ProtoBuf.cmake
  3. +1 −1 src/network_utils.h
  4. +4 −0 src/zmq_van.h
View
@@ -33,6 +33,7 @@ list(APPEND pslite_INCLUDE_DIR_L "${PROJECT_BINARY_DIR}/include/")
FILE(GLOB SOURCE "src/*.cc")
if(MSVC)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
FILE(GLOB getopt_SOURCE "src/windows/getopt.c")
list(APPEND SOURCE ${getopt_SOURCE})
add_definitions(-DSTATIC_GETOPT)
@@ -67,9 +67,6 @@ function(pslite_protobuf_generate_cpp_py output_dir srcs_var hdrs_var python_var
list(APPEND ${hdrs_var} "${o_fil_path}/${fil_we}.pb.h")
list(APPEND ${python_var} "${o_fil_path}/${fil_we}_pb2.py")
- message("o_fil:" ${_protoc_include})
- message("o_fil:" ${o_fil})
- message("proto_path:" ${proto_path})
add_custom_command(
OUTPUT "${o_fil_path}/${fil_we}.pb.cc"
"${o_fil_path}/${fil_we}.pb.h"
View
@@ -8,8 +8,8 @@
#include <unistd.h>
#ifdef _MSC_VER
#include <tchar.h>
+#include <winsock2.h>
#include <windows.h>
-#include <winsock.h>
#include <iphlpapi.h>
#undef interface
#else
View
@@ -8,6 +8,10 @@
#include <thread>
#include <string>
#include "ps/internal/van.h"
+#if _MSC_VER
+#define rand_r(x) rand()
+#endif
+
namespace ps {
/**
* \brief be smart on freeing recved data

0 comments on commit 4a8b805

Please sign in to comment.