From 28f6559947b7acd2ef3c983c90e1215a0d75ae15 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Tue, 5 Sep 2023 23:00:28 -0700 Subject: Add the ATLMFC include directory to the libc include dir list https://learn.microsoft.com/en-us/cpp/mfc/mfc-and-atl Note that this include directory gets added to %INCLUDE% by vcvarsall.bat, and is especially crucial when working with resource files (many .rc files within the https://github.com/microsoft/Windows-classic-samples/ set reference files from the ATLMFC include directory). --- src/Compilation.zig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 2135ab8245..fdc154e0eb 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -5636,6 +5636,13 @@ fn detectLibCFromLibCInstallation(arena: Allocator, target: Target, lci: *const if (!is_redundant) list.appendAssumeCapacity(lci.sys_include_dir.?); if (target.os.tag == .windows) { + if (std.fs.path.dirname(lci.sys_include_dir.?)) |sys_include_dir_parent| { + // This include path will only exist when the optional "Desktop development with C++" + // is installed. It contains headers, .rc files, and resources. It is especially + // necessary when working with Windows resources. + const atlmfc_dir = try std.fs.path.join(arena, &[_][]const u8{ sys_include_dir_parent, "atlmfc", "include" }); + list.appendAssumeCapacity(atlmfc_dir); + } if (std.fs.path.dirname(lci.include_dir.?)) |include_dir_parent| { const um_dir = try std.fs.path.join(arena, &[_][]const u8{ include_dir_parent, "um" }); list.appendAssumeCapacity(um_dir); -- cgit v1.2.3