How to use stb_image.h OR Are there any good zig image processing libs for 0.12.0

You just need this in stb_image.c:

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

Then in your build.zig you can add this file to the executable like this:

exe.addCSourceFiles(.{.files = &[_][]const u8{"path/to/stb_image.c"}, .flags = .{"-g"}}); // -g adds debug info, makes it easier to debug
2 Likes