davisking/dlib

[Bug]: threads_kernel_1.h includes windows.h header

MattiasDC opened this issue · 1 comments

What Operating System(s) are you seeing this problem on?

Windows

dlib version

19.24.4

Python version

3.8

Compiler

MSVC 19.38

Expected Behavior

We should be able to create enum like this:

enum class Status { ERROR, OK };

while also including dlib headers in the same file.

Current Behavior

We get a compilation error since threads_kernel_1.h includes the windows.h header which defines a ton of macros and defines. Among which 'OPTIONAL' and 'ERROR'. This prevents us from using enum values named 'OPTIONAL' and 'ERROR' when we also include dlib headers.

Steps to Reproduce

Define the previously mentioned enum on a Windows system, while also including the threads_kernel_1.h header at the top of the file

Anything else?

Suggestion is to move the windows.h include to the cpp such that no headers depend on windows.h

Yeah good idea. That header is not really needed there anymore.