Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MattiasDC opened this issue Apr 26, 2024 · 1 comment · Fixed by #2952
Closed

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

MattiasDC opened this issue Apr 26, 2024 · 1 comment · Fixed by #2952

Comments

@MattiasDC
Copy link

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

@davisking
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants