From 315bd3a9c82c28aa0349d5e52d45415c9d5e0ddf Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 22 Apr 2019 21:22:00 +0200 Subject: [PATCH] Only include windows.h using host.h host.h sets the macros NOMINMAX and WIN32_LEAN_AND_MEAN which must be set before including windows.h. Signed-off-by: Stefan Weil --- src/api/altorenderer.cpp | 6 +++--- src/api/hocrrenderer.cpp | 6 +++--- src/ccutil/ccutil.h | 7 ++++--- src/ccutil/fileio.cpp | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/api/altorenderer.cpp b/src/api/altorenderer.cpp index 67c7da17f..c484829ce 100644 --- a/src/api/altorenderer.cpp +++ b/src/api/altorenderer.cpp @@ -15,10 +15,10 @@ #include #include // for std::stringstream -#ifdef _WIN32 -# include // MultiByteToWideChar, ... -#endif #include "baseapi.h" +#ifdef _WIN32 +# include "host.h" // windows.h for MultiByteToWideChar, ... +#endif #include "renderer.h" namespace tesseract { diff --git a/src/api/hocrrenderer.cpp b/src/api/hocrrenderer.cpp index a169692a6..278899fb8 100644 --- a/src/api/hocrrenderer.cpp +++ b/src/api/hocrrenderer.cpp @@ -20,10 +20,10 @@ #include // for std::locale::classic #include // for std::unique_ptr #include // for std::stringstream -#ifdef _WIN32 -# include // MultiByteToWideChar, ... -#endif #include "baseapi.h" // for TessBaseAPI +#ifdef _WIN32 +# include "host.h" // windows.h for MultiByteToWideChar, ... +#endif #include "renderer.h" #include "tesseractclass.h" // for Tesseract diff --git a/src/ccutil/ccutil.h b/src/ccutil/ccutil.h index 5fe27c12f..71e89c603 100644 --- a/src/ccutil/ccutil.h +++ b/src/ccutil/ccutil.h @@ -19,15 +19,16 @@ #ifndef TESSERACT_CCUTIL_CCUTIL_H_ #define TESSERACT_CCUTIL_CCUTIL_H_ -#ifdef _WIN32 -#include // HANDLE, ... -#else +#ifndef _WIN32 #include #include #endif #include "ambigs.h" #include "errcode.h" +#ifdef _WIN32 +#include "host.h" // windows.h for HANDLE, ... +#endif #include "strngs.h" #include "params.h" #include "unicharset.h" diff --git a/src/ccutil/fileio.cpp b/src/ccutil/fileio.cpp index 45d17695a..a9c8cb64c 100644 --- a/src/ccutil/fileio.cpp +++ b/src/ccutil/fileio.cpp @@ -15,7 +15,6 @@ **********************************************************************/ #ifdef _WIN32 -#include // BOOL, ... #ifndef unlink #include #endif @@ -30,6 +29,7 @@ #include "errcode.h" #include "fileio.h" +#include "host.h" // includes windows.h for BOOL, ... #include "tprintf.h" namespace tesseract {