Skip to content
New issue

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

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

Already on GitHub? # to your account

MSVC error about APIENTRY when including windows.h after epoxy/gl.h #299

Open
benjamin-otte opened this issue Oct 21, 2024 · 1 comment
Open

Comments

@benjamin-otte
Copy link

benjamin-otte commented Oct 21, 2024

In my adventure to compile GTK with VS Code, I turned on --werror today, and I got this:

C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\minwindef.h(130): error C2220: the following warning is treated as an error
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\minwindef.h(130): warning C4005: 'APIENTRY': macro redefinition
C:\Users\company\git\gtk\subprojects\libepoxy\include\epoxy/gl.h(59): note: see previous definition of 'APIENTRY'

This happens because Windows and GL incldues are sprinkled all over the GTK codebase and sometimes a source file ends up including both in some unpredictable order.

I'm sure you're aware that APIENTRY is defined in WinDef.h.

So I'm wondering if I should work around this in GTK (by including WinDef.h before any gl.h include) or if epoxy should do something like include it or if it should #undef APIENTRY at the end or something like it.

gnomesysadmins pushed a commit to GNOME/gtk that referenced this issue Oct 21, 2024
epoxy defines it if windows.h hasn't been included.
So include windows.h before epoxy.

See also anholt/libepoxy#299
@ebassi
Copy link
Collaborator

ebassi commented Nov 11, 2024

This is #294

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

No branches or pull requests

2 participants