Help add c include path

Hi all!
Very new to ZiG,
trying to import c header that is located in standard /usr/include, but doing something like

const stuff = @cImport({

yields error: 'mystuff.h' file not found

i’ve googled around and found a simple solution - to add to build.zig something like exe.addIncludeDir("/usr/include");
while it itself looks like a hack - I cannot even find addIncludeDir function in zig 0.11, and cannot find any release notes about it…

can please someone help me with this tiny thing?

Hi @hex, welcome to ziggit.

The function is called addIncludePath
Usage is: exe.addIncludePath(.{ .path = "/path/to/include" });

1 Like

Oh thank you!
By the way, is this the best way to do it? Sounds like including standard locations like /usr/include may be done with some special flag/option/function, no?

1 Like

I don’t know. I am guessing, that zig does not include the system includes because it bundles c libraries like musl, gnu and mingw.