I am trying to use readline in my Zig project.
I managed to make the linker find it by adding this to the build file:
exe.linkLibC();
exe.addIncludeDir("/usr/local/opt/readline/include");
exe.addLibPath("/usr/local/opt/readline/lib");
Even though it finds readline definitions it seems it doesn't "see" the C lib...
Error:
▶ zig build
./src/main.zig:1:18: error: C import failed
const readline = @cImport({
^
/usr/local/opt/readline/include/readline/rltypedefs.h:71:36: note: unknown type name 'FILE'
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/local/opt/readline/include/readline/readline.h:448:28: note: unknown type name 'FILE'
extern int rl_getc PARAMS((FILE *));
^
/usr/local/opt/readline/include/readline/readline.h:578:8: note: unknown type name 'FILE'
extern FILE *rl_instream;
^
/usr/local/opt/readline/include/readline/readline.h:579:8: note: unknown type name 'FILE'
extern FILE *rl_outstream;
^
/usr/local/opt/readline/include/readline/readline.h:937:3: note: unknown type name 'FILE'
FILE *inf;
^
/usr/local/opt/readline/include/readline/readline.h:938:3: note: unknown type name 'FILE'
FILE *outf;
^
zig-lua...The following command exited with error code 1:
How can I make it work?