From efe274873062764fd63b696765e077add1538d62 Mon Sep 17 00:00:00 2001 From: Jonathan Swartz Date: Tue, 7 Jul 2026 00:08:20 +0000 Subject: [PATCH] Fix vdb_view Windows build: include windows.h before GL/glu.h 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 --- openvdb_cmd/vdb_view/RenderModules.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openvdb_cmd/vdb_view/RenderModules.cc b/openvdb_cmd/vdb_view/RenderModules.cc index 01912f8e3f..6c49fd1917 100644 --- a/openvdb_cmd/vdb_view/RenderModules.cc +++ b/openvdb_cmd/vdb_view/RenderModules.cc @@ -14,6 +14,13 @@ #include #if defined(_WIN32) +// GL/glu.h requires APIENTRY and CALLBACK from windows.h. GL/glew.h only defines +// them temporarily (undefining them at the end of the header), so windows.h must +// be included before GL/glu.h rather than relying on a transitive include. +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include #include #endif