You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by if...@apache.org on 2022/06/27 02:20:13 UTC
[rocketmq-client-cpp] branch master updated: avoid redefine error when include Windows.h and Winsock2.h at same time
This is an automated email from the ASF dual-hosted git repository.
ifplusor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new 8f9eeed avoid redefine error when include Windows.h and Winsock2.h at same time
8f9eeed is described below
commit 8f9eeeda01b0520dcd499bfc6d137c67d010c957
Author: SRC-xiaojin <zt...@163.com>
AuthorDate: Sat Jun 25 12:19:27 2022 +0800
avoid redefine error when include Windows.h and Winsock2.h at same time
(cherry picked from commit 6108dc5619a58c8b54e4604cb6dfedf5d2de74a1)
---
include/MQMessageExt.h | 5 ++++-
src/transport/SocketUtil.h | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/MQMessageExt.h b/include/MQMessageExt.h
index 194043e..c269985 100644
--- a/include/MQMessageExt.h
+++ b/include/MQMessageExt.h
@@ -18,8 +18,11 @@
#define __MESSAGEEXT_H__
#ifdef WIN32
-#include <Windows.h>
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
#include <Winsock2.h>
+#include <Windows.h>
#else
#include <sys/socket.h>
#endif
diff --git a/src/transport/SocketUtil.h b/src/transport/SocketUtil.h
index e6156a6..55cb5a2 100644
--- a/src/transport/SocketUtil.h
+++ b/src/transport/SocketUtil.h
@@ -18,9 +18,12 @@
#define __SOCKETUTIL_H__
#ifdef WIN32
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
#include <WS2tcpip.h>
-#include <Windows.h>
#include <Winsock2.h>
+#include <Windows.h>
#pragma comment(lib, "ws2_32.lib")
#else
#include <arpa/inet.h>