Skip to content

fix(windows): import std::min/std::max before gdiplus.h under NOMINMAX - #113

Merged
lijy91 merged 1 commit into
mainfrom
fix/windows-gdiplus-nominmax-issue-77
Dec 2, 2026
Merged

lijy91 merged 1 commit into
mainfrom
fix/windows-gdiplus-nominmax-issue-77

Conversation

@lijy91

@lijy91 lijy91 commented Dec 2, 2026

Copy link
Copy Markdown
Member

Fixes libnativeapi/nativeapi#77.

Summary

  • Bring std::min / std::max into scope via <algorithm> before #include <gdiplus.h> in window_taskbar_windows.cpp and the remaining Windows source files that include <gdiplus.h> (clipboard_windows.cpp, drag_source_windows.cpp, image_windows.cpp, menu_winui3_windows.cpp), matching the existing pattern in view_windows.cpp and view_winui3_windows.cpp.
  • Prevents MSVC error C3861: 'min'/'max': identifier not found in <GdiplusTypes.h> when compiling with NOMINMAX against older Windows 10 SDKs (such as 10.0.19041.0).

Verification

  • Built nativeapi on Windows with MSVC and -DCMAKE_CXX_FLAGS="/DNOMINMAX".

@lijy91
lijy91 force-pushed the fix/windows-gdiplus-nominmax-issue-77 branch from d3eca7a to f94fa0d Compare December 2, 2026 21:01
@lijy91
lijy91 merged commit ea05fcc into main Dec 2, 2026
9 of 11 checks passed
@lijy91
lijy91 deleted the fix/windows-gdiplus-nominmax-issue-77 branch December 2, 2026 21:08
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 this pull request may close these issues.

window_manager: On windows, build fails on 0.7.2 (cnativeapi 0.6.3): 'min'/'max': identifier not found in GdiplusTypes.h

1 participant