#C import failed error

1 messages · Page 1 of 1 (latest)

half fractal
#

I'm trying to compile https://github.com/dearimgui/dear_bindings which i know is a thing that has been done before, but i can't quite figure out what i'm doing wrong.
In my code i have:

const cimgui = @cImport({
    @cInclude("cimgui.h");
});

I use that with:

    cimgui.ImGui_CreateContext(null);

and the compiler tells me:

main.zig:2:16: error: C import failed
const cimgui = @cImport({
               ^~~~~~~~
referenced by:
    main: src/main.zig:25:5
    comptime_0: zig-linux-x86_64-0.11.0-dev.203+58d9004ce/lib/std/start.zig:59:50

But doesn't give me any actual errors, i can't figure out what i need to fix. Any pointers would be great

dawn osprey
#

You can use zig translate-c cimgui.h with the same compile flags as you pass to build-exe to get more detailed info

#

(That's all cImport does internally)

half fractal
#

oh thanks that helped. The header was just missing including assert.h and stdio.h

half fractal
#

got it working. Thanks for the help!

wide jacinth
#

@half fractal Sorry for the bump, but can you share your setup? I am trying to do the same but I can't seem to figure out how to use the implementation headers (in my case opengl3 with glfw) from dear_bindings.

half fractal
wide jacinth