mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
langref: minor documentation fixes to addCSourceFile (#16785)
This commit is contained in:
parent
fd830b146d
commit
f1992a39a5
@ -10819,11 +10819,11 @@ pub fn build(b: *std.Build) void {
|
|||||||
|
|
||||||
{#header_open|Compiling C Source Code#}
|
{#header_open|Compiling C Source Code#}
|
||||||
<pre>{#syntax#}
|
<pre>{#syntax#}
|
||||||
lib.addCSourceFile("src/lib.c", &[_][]const u8{
|
lib.addCSourceFile(.{ .file = .{ .path = "src/lib.c" }, .flags = &.{
|
||||||
"-Wall",
|
"-Wall",
|
||||||
"-Wextra",
|
"-Wextra",
|
||||||
"-Werror",
|
"-Werror",
|
||||||
});
|
} });
|
||||||
{#endsyntax#}</pre>
|
{#endsyntax#}</pre>
|
||||||
{#header_close#}
|
{#header_close#}
|
||||||
|
|
||||||
@ -11180,7 +11180,7 @@ pub fn build(b: *std.Build) void {
|
|||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
});
|
});
|
||||||
exe.addCSourceFile("test.c", &[_][]const u8{"-std=c99"});
|
exe.addCSourceFile(.{ .file = .{ .path = "test.c" }, .flags = &.{"-std=c99"} });
|
||||||
exe.linkLibrary(lib);
|
exe.linkLibrary(lib);
|
||||||
exe.linkSystemLibrary("c");
|
exe.linkSystemLibrary("c");
|
||||||
|
|
||||||
@ -11247,10 +11247,10 @@ pub fn build(b: *std.Build) void {
|
|||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
});
|
});
|
||||||
exe.addCSourceFile("test.c", &[_][]const u8{"-std=c99"});
|
exe.addCSourceFile(.{ .file = .{ .path = "test.c" }, .flags = &.{"-std=c99",} });
|
||||||
exe.addObject(obj);
|
exe.addObject(obj);
|
||||||
exe.linkSystemLibrary("c");
|
exe.linkSystemLibrary("c");
|
||||||
exe.install();
|
b.installArtifact(exe);
|
||||||
}
|
}
|
||||||
{#code_end#}
|
{#code_end#}
|
||||||
{#shell_samp#}$ zig build
|
{#shell_samp#}$ zig build
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user