From 7b3afc880b1ab018e6cec5f429de44a04088bacb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 7 Jan 2024 16:19:23 -0700 Subject: Compilation: add definition to prefer ucrt for windows C/C++ files This makes C/C++ files when targeting mingw-w64 choose to depend on ucrt for stdio. --- src/Compilation.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index cfd1a2fc31..f02a6e67cc 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -5100,7 +5100,10 @@ pub fn addCCArgs( if (target.os.tag == .windows) switch (ext) { .c, .cpp, .m, .mm, .h, .cu, .rc, .assembly, .assembly_with_cpp => { const minver: u16 = @truncate(@intFromEnum(target.os.getVersionRange().windows.min) >> 16); - try argv.append(try std.fmt.allocPrint(argv.allocator, "-D_WIN32_WINNT=0x{x:0>4}", .{minver})); + try argv.appendSlice(&.{ + try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}), + "-D__MSVCRT_VERSION__=0xE00", // use ucrt + }); }, else => {}, }; -- cgit v1.2.3