From 708511adcb46b2098f2d923537a2710aed1450da 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 | 4 ++-- src/api/hocrrenderer.cpp | 4 ++-- src/ccutil/ccutil.h | 7 ++++--- src/ccutil/fileio.cpp | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/api/altorenderer.cpp b/src/api/altorenderer.cpp index 67c7da17f7..c484829ce1 100644 --- a/src/api/altorenderer.cpp +++ b/src/api/altorenderer.cpp @@ -15,10 +15,10 @@ #include #include // for std::stringstream +#include "baseapi.h" #ifdef _WIN32 -# include // MultiByteToWideChar, ... +# include "host.h" // windows.h for MultiByteToWideChar, ... #endif -#include "baseapi.h" #include "renderer.h" namespace tesseract { diff --git a/src/api/hocrrenderer.cpp b/src/api/hocrrenderer.cpp index 1b4cd0e485..cd3016ac2c 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 +#include "baseapi.h" // for TessBaseAPI #ifdef _WIN32 -# include // MultiByteToWideChar, ... +# include "host.h" // windows.h for MultiByteToWideChar, ... #endif -#include "baseapi.h" // for TessBaseAPI #include "renderer.h" #include "tesseractclass.h" // for Tesseract diff --git a/src/ccutil/ccutil.h b/src/ccutil/ccutil.h index 5fe27c12f8..71e89c603e 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 45d17695ad..a9c8cb64c7 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 {