Static library from C source file

In v0.11 I could have a b.addStaticLibray in build.zig with a root file pointing to a C source file. I could then link the exe to that library and it all worked fine. It seems now this isn’t the way to do it. Any hints on how to do this in v0.12+? (I’m getting an invalid bytes error pointing right at the first byte in the C file #include... as if trying to compile it as a Zig file.)

Use addCSourceFile to add your C file and don’t initialize root_source_file or set it to null.

1 Like