diff --git a/addons/ofxNetwork/src/ofxNetworkUtils.h b/addons/ofxNetwork/src/ofxNetworkUtils.h index 00d5dcec8b2..d9b63ba22c1 100644 --- a/addons/ofxNetwork/src/ofxNetworkUtils.h +++ b/addons/ofxNetwork/src/ofxNetworkUtils.h @@ -8,8 +8,6 @@ #pragma once #include -#include "ofConstants.h" - #ifdef TARGET_WIN32 #include @@ -19,6 +17,10 @@ #define OFXNETWORK_ERROR(name) E ## name #endif +// WinSock2.h has to be included before windows.h +#include "ofConstants.h" + + /** * @brief Log the latest network error and where it happened (file and line) * diff --git a/addons/ofxNetwork/src/ofxTCPManager.h b/addons/ofxNetwork/src/ofxTCPManager.h index 87acbffd40e..88e95e34d37 100644 --- a/addons/ofxNetwork/src/ofxTCPManager.h +++ b/addons/ofxNetwork/src/ofxTCPManager.h @@ -43,6 +43,7 @@ SetTimeoutReceive() ****************************************************************/ #include "ofConstants.h" + #include #include #include @@ -82,6 +83,9 @@ SetTimeoutReceive() #include // TCP/IP annex needed for multicasting #endif + + + //-------------------------------------------------------------------------------- class InetAddr : public sockaddr_in { diff --git a/addons/ofxNetwork/src/ofxUDPManager.h b/addons/ofxNetwork/src/ofxUDPManager.h index 49afb9ab2b6..ba7ccc78e9d 100644 --- a/addons/ofxNetwork/src/ofxUDPManager.h +++ b/addons/ofxNetwork/src/ofxUDPManager.h @@ -68,6 +68,7 @@ x) Close() #include #include + #ifndef TARGET_WIN32 //unix includes - works for osx should be same for *nix diff --git a/libs/openFrameworks/utils/ofConstants.h b/libs/openFrameworks/utils/ofConstants.h index c80947718df..79b7381cd41 100644 --- a/libs/openFrameworks/utils/ofConstants.h +++ b/libs/openFrameworks/utils/ofConstants.h @@ -88,6 +88,9 @@ enum ofTargetPlatform{ // http://www.ogre3d.org/docs/api/html/OgrePlatform_8h-source.html #if defined( __WIN32__ ) || defined( _WIN32 ) +#define WIN32_LEAN_AND_MEAN +#define _WINSOCKAPI_ + #include #define OF_OS_WINDOWS #define TARGET_WIN32 #if defined(_MSC_VER) diff --git a/libs/openFrameworks/utils/ofSystemUtils.cpp b/libs/openFrameworks/utils/ofSystemUtils.cpp index 33b530226cc..2629823a585 100644 --- a/libs/openFrameworks/utils/ofSystemUtils.cpp +++ b/libs/openFrameworks/utils/ofSystemUtils.cpp @@ -25,7 +25,6 @@ #define _WIN32_DCOM #include #include -#include #include #include #include