I am attempting to use the Win32 API in Zig without linking libc, since the former does not rely on the latter:
const windows = @cImport({
@cDefine("UNICODE", {});
@cDefine("_UNICODE", {});
@cDefine("WIN32_LEAN_AND_MEAN", {});
@cInclude("windows.h");
});
However, when I try to build the above, even when using zig build -Dtarget=x86_64-windows-msvc
(to account for the fact MinGW may potentially use libc), I get the error:
src\main.zig:1:17: error: C import failed
const windows = @cImport({
^~~~~~~~
src\main.zig:1:17: note: libc headers not available; compilation does not link against libc
How can I @cInclude
C headers without linking libc?
You need to sign in to view this answers