commit 92e781baa147a7d07af4cb3c1f08c08bed8613e4 (tree) parent 9a9a7daef0aff340e029fb9bb6d29361a3d7e767 Author: Andrew Kelley <andrew@ziglang.org> Date: Tue, 16 Jul 2019 11:50:34 -0400 fix documentation regarding mixing object files closes #2905 Diffstat:
| M | doc/langref.html.in | | | 14 | +++++--------- |
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/doc/langref.html.in b/doc/langref.html.in @@ -9210,20 +9210,16 @@ const Builder = @import("std").build.Builder; pub fn build(b: *Builder) void { const obj = b.addObject("base64", "base64.zig"); - const exe = b.addCExecutable("test"); - exe.addCompileFlags([_][]const u8 { - "-std=c99", - }); - exe.addSourceFile("test.c"); + const exe = b.addExecutable("test", null); + exe.addCSourceFile("test.c", [_][]const u8{"-std=c99"}); exe.addObject(obj); - exe.setOutputPath("."); - - b.default_step.dependOn(&exe.step); + exe.linkSystemLibrary("c"); + exe.install(); } {#code_end#} <p class="file">terminal</p> <pre><code class="shell">$ zig build -$ ./test +$ ./zig-cache/bin/test all your base are belong to us</code></pre> {#see_also|Targets|Zig Build System#} {#header_close#}