Skip to content

Commit a532de5

Browse files
authored
Fix vdb_view Windows build: include windows.h before GL/glu.h (#2247)
GL/glu.h uses APIENTRY without defining it. This previously compiled because oneTBB (<= 2022.3) transitively included windows.h from its public headers; oneTBB 2023.0 removed that include, so APIENTRY is no longer defined when RenderModules.cc includes GL/glu.h. GL/glew.h cannot provide it either: it undefines APIENTRY at the end of the header when it was the one defining it (and the vcpkg glew package additionally patches out glew.h's internal GL/glu.h include). Include windows.h explicitly before GL/glu.h instead of relying on a transitive include. Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
1 parent acca53b commit a532de5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

openvdb_cmd/vdb_view/RenderModules.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
#include <openvdb/util/Assert.h>
1515

1616
#if defined(_WIN32)
17+
// GL/glu.h requires APIENTRY and CALLBACK from windows.h. GL/glew.h only defines
18+
// them temporarily (undefining them at the end of the header), so windows.h must
19+
// be included before GL/glu.h rather than relying on a transitive include.
20+
#ifndef WIN32_LEAN_AND_MEAN
21+
#define WIN32_LEAN_AND_MEAN
22+
#endif
23+
#include <windows.h>
1724
#include <GL/glu.h>
1825
#endif
1926

0 commit comments

Comments
 (0)