You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to Reproduce:
1. Create a header file in your project:
mylib/mylib.h
2. Add the header path in build.zig:
exe.addIncludePath(b.path("mylib"));
3. In your .zig file, use:
const c = @cImport({ @Cinclude("mylib.h");
});
4. Initially (by mistake), use: @Cinclude(<mylib.h>);
5. Fix it by changing to quotes and deleting .zig-cache: @Cinclude("mylib.h");
• Even after correcting to @cInclude("mylib.h") and clearing .zig-cache
• The build fails with:
error: 'mylib.h' file not found
Expected Behavior
• After correcting to @cInclude("mylib.h") and clearing .zig-cache, Zig should regenerate cimport.h using quotes, not angle brackets.
• The build should succeed if the header is available in addIncludePath.
The text was updated successfully, but these errors were encountered:
alsanie360
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Apr 2, 2025
Working as intended, @cInclude always emits code using '#include <angle_brackets> rather than #cinclude "quoted". Your original code of @cInclude(<mylib.h>) is not valid Zig syntax, and will have emitted a compile error and not generated any C code at all.
Note that @cImport and friends are set to be deleted: #20630
Zig Version
0.14.0
Steps to Reproduce and Observed Behavior
Environment:
• Zig version: 0.14.0
• Platform: macOS 15 (Apple Silicon M3)
Steps to Reproduce:
1. Create a header file in your project:
mylib/mylib.h
2. Add the header path in build.zig:
exe.addIncludePath(b.path("mylib"));
3. In your .zig file, use:
const c = @cImport({
@Cinclude("mylib.h");
});
4. Initially (by mistake), use:
@Cinclude(<mylib.h>);
5. Fix it by changing to quotes and deleting .zig-cache:
@Cinclude("mylib.h");
Observed Behavior:
• Zig continues to generate cimport.h with:
#include <mylib.h>
Expected Behavior
The text was updated successfully, but these errors were encountered: