add a compile error note when C import fails and not linking libc

closes #558
This commit is contained in:
Andrew Kelley
2019-02-25 19:31:30 -05:00
parent 0f54728cf0
commit 3ca861c7dd
2 changed files with 15 additions and 0 deletions

View File

@@ -1,6 +1,17 @@
const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.addTest(
"libc headers note",
\\const c = @cImport(@cInclude("stdio.h"));
\\export fn entry() void {
\\ c.printf("hello, world!\n");
\\}
,
".tmp_source.zig:1:11: error: C import failed",
".tmp_source.zig:1:11: note: libc headers not available; compilation does not link against libc",
);
cases.addTest(
"comptime vector overflow shows the index",
\\comptime {