Skip to content

Error: redeclaration of function parameter 'apply' #1

@nichitacebotari0

Description

@nichitacebotari0

Hello, trying to learn zig using sqlite.
Ive created a new project with zig init-exe and tried adding sqlite according to readme. Am unsure of what Im doing wrong.

    const exe = b.addExecutable("zig_sqlite", "src/main.zig");
    exe.setTarget(target);
    exe.setBuildMode(mode);

    //sqlite3 riyaz
    exe.linkLibC();
    exe.addIncludeDir("src/sqlite3/");
    exe.addCSourceFile("src/sqlite3/amalgamation/sqlite3.c", &[_][]const u8 {
    // any compile-time flags that you might want to add
    // see: https://www.sqlite.org/compile.html
    });
    exe.addPackagePath("sqlite3.zig", "src/sqlite3/lib/sqlite3.zig");

    exe.install();

But zig build fails with:

C:\Projects\zig_sqlite\src\sqlite3\lib\func.zig:42:12: error: redeclaration of function parameter 'apply'
        fn apply(ctx: ?*c.sqlite3_context, argc: c_int, argv: [*c]?*c.sqlite3_value) callconv(.C) void {
           ^~~~~
C:\Projects\zig_sqlite\src\sqlite3\lib\func.zig:29:14: note: previous declaration here
    comptime apply: fn (@TypeOf(ptr), *sqlite3.Context, []const *sqlite3.Value) void,
             ^~~~~
C:\Projects\zig_sqlite\src\sqlite3\lib\func.zig:82:12: error: redeclaration of function parameter 'step'
        fn step(ctx: ?*c.sqlite3_context, argc: c_int, argv: [*c]?*c.sqlite3_value) callconv(.C) void {
           ^~~~
C:\Projects\zig_sqlite\src\sqlite3\lib\func.zig:68:14: note: previous declaration here
    comptime step: fn (@TypeOf(ptr), *sqlite3.Context, []const *sqlite3.Value) void,
             ^~~~
C:\Projects\zig_sqlite\src\sqlite3\lib\func.zig:129:12: error: redeclaration of function parameter 'step'
        fn step(ctx: ?*c.sqlite3_context, argc: c_int, argv: [*c]?*c.sqlite3_value) callconv(.C) void {
           ^~~~
C:\Projects\zig_sqlite\src\sqlite3\lib\func.zig:113:14: note: previous declaration here
    comptime step: fn (@TypeOf(ptr), *sqlite3.Context, []const *sqlite3.Value) void,
             ^~~~
C:\Projects\zig_sqlite\src\sqlite3\lib\sqlite3.zig:38:38: error: expected type '[*c]const u8', found '[:0]const u8'
    const result = c.sqlite3_open_v2(path, &db, flags, null);
                                     ^~~~
error: zig_sqlite...

I have uploaded the test branch in case that helps: https://github.com/nichitacebotari0/zig_sqlite_test/tree/riyaz_sqlite
Note: Made 1 small change to CImport inside the submoduled repo to use absolute path to get 1 less error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions