I tried using rgfw, which is a single header library written in c, using Zig’s C interop, in a fairly recent (0.16.0-dev.747+493ad58ff) zig master version.
This compiles and works on Linux, but when compiling on my windows vm, this happens:
error: translation failure
C:\zig\lib\include\xmmintrin.h:3197:27: error: function-like macro '__building_module' is not defined
#if defined(__SSE2__) && !__building_module(_Builtin_intrinsics)
^
C:\Users\vm\zig\app\src\RGFW.h:4673:10: error: 'poll.h' not found
#include <poll.h>
^
However compiling an equivalent program in C directly with clang works (even on the VM), meaning it isn’t a problem with RGFW being ‘malformed’.
You can either downgrade to the stable 1.15.2 or implement all the functions yourself binding style.
I made a bindings project for RGFW that does exactly this but its a bit outdated at the moment as I am going through a full rewrite (check it out here if you wish), but the basic idea goes as follows;
I would avoid applying @cImport to the implementation part of any header only library, because it is unnecessary and increases the chances that you will have problems with the c translation. Instead just use @cImport with the header (without the implementation define set) and then add the implementation by adding it as a c source (for example by adding the c source to the module via the build system).
I assume you’re trying to import just the header definitions using @cInclude as @Sze suggested.
In which case, and also in the case of my previous example, you would have to use exe.root_module.addCMacro("RGFW_IMPLEMENTATION", ""); so that RGFW includes the full implementation through the build system.
I believe @cInclude searches your projects include locations for the file so you would have to add that to your build.zig with exe.addIncludePath(rgfw_dep.path("")); as well.