From e9e944f77a2a58d0556f88d4504e569ff37feece Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 10 Jul 2026 08:51:54 +1000 Subject: [PATCH] ifcviewer: include MetalSurface_mac.h before its use (fix macOS build) createWgpuSurface() calls wgpu_macos_attach_metal_layer() in the Q_OS_MAC branch at the top of the file, but the only #include of MetalSurface_mac.h sat ~450 lines below the call site, so macOS builds failed with 'use of undeclared identifier'. The header self-guards on __APPLE__, so move the include up into the early platform block next to ; the lone call site is the sole consumer, so the late include was dead. Co-Authored-By: Claude Opus 4.8 --- src/ifcviewer/ViewportWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ifcviewer/ViewportWindow.cpp b/src/ifcviewer/ViewportWindow.cpp index c1acab8bbc..6e70280173 100644 --- a/src/ifcviewer/ViewportWindow.cpp +++ b/src/ifcviewer/ViewportWindow.cpp @@ -45,6 +45,10 @@ #define NOMCX #define NOSERVICE #include +#elif defined(Q_OS_MAC) +// Cocoa bridge declared here, implemented in the adjacent .mm file. Must be +// visible before createWgpuSurface() below calls wgpu_macos_attach_metal_layer. +#include "MetalSurface_mac.h" #endif #include @@ -832,10 +836,6 @@ bool ViewportWindow::initWgpu() { # define WIN32_LEAN_AND_MEAN # endif # include -#elif defined(Q_OS_MAC) -// Cocoa bridge declared in MetalSurface_mac.h, implemented in the -// adjacent .mm file. Keeps Objective-C out of this pure-C++ TU. -# include "MetalSurface_mac.h" #endif // Private bool createSurface() removed in #84-l — its body is now