From ef2b755d77b88a122c6cb9a7928fb5c8f879392a Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 13 Jun 2017 19:34:28 +0300 Subject: [PATCH] Fix include in error_code_test on cygwin/mingw --- test/error_code_test.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/error_code_test.cpp b/test/error_code_test.cpp index a9a928e..3cad994 100644 --- a/test/error_code_test.cpp +++ b/test/error_code_test.cpp @@ -30,14 +30,20 @@ // with a boost::system using directive increases use scenario coverage. using namespace boost::system; -# if defined( BOOST_WINDOWS_API ) -# include "winerror.h" -# define BOOST_ACCESS_ERROR_MACRO ERROR_ACCESS_DENIED -# elif defined( BOOST_POSIX_API ) -# define BOOST_ACCESS_ERROR_MACRO EACCES -# else -# error "Only supported for POSIX and Windows" -# endif +#if defined( BOOST_WINDOWS_API ) +// Neither MinGW or Cygwin versions of winerror.h work if used alone, so on +// either of those platforms include the full windows.h +# if defined(__MINGW32__) || defined(__CYGWIN__) +# include +# else +# include +# endif +# define BOOST_ACCESS_ERROR_MACRO ERROR_ACCESS_DENIED +#elif defined( BOOST_POSIX_API ) +# define BOOST_ACCESS_ERROR_MACRO EACCES +#else +# error "Only supported for POSIX and Windows" +#endif namespace {