Hello, i was trying to make a simple program to learn the pipewire api but i cannot get zig to find the header files
i’m using a simple build file and adding the library with linkSystemLibrary()
but i don’t know if there is something else i have to do to add the include directories, or if this is just a bug because all examples i could find only use linkSystemLibrary()
i’m on NixOS so i don’t want to have to hardcode the paths to the library
heres the build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "hello",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe.linkSystemLibrary("pipewire-0.3");
exe.linkLibC();
b.installArtifact(exe);
const run_exe = b.addRunArtifact(exe);
const run_step = b.step("run", "Run the program");
run_step.dependOn(&run_exe.step);
}
and here is main.zig
const std = @import("std");
const pw = @cImport({
@cInclude("pipewire/pipewire.h");
});
const print = std.debug.print;
pub fn main() void {
pw.pw_init(null, null);
print("header version {s}/n", .{pw.pw_get_headers_version()});
}
btw i already tried compiling the pipewire example in c and it does work so it is not my nix config