Skip to content

undefined ImGui symbols when using Vulkan + glfw backend on macOS #68

@zxubian

Description

@zxubian

Environment:

Build.zig

const renderer_module = b.addModule(
        "renderer",
        .{
            .root_source_file = b.path("./src/Render/root.zig"),
            .target = target,
            .optimize = optimize,
        },
);

//...

const zgui = b.dependency("zgui", .{
        .target = target,
        .optimize = optimize,
        .backend = .glfw_vulkan,
});
const zgui_module = zgui.module("root");
const imgui = zgui.artifact("imgui");
imgui.addIncludePath(vulkan_headers.path("include"));
renderer_module.addImport("zgui", zgui_module);
renderer_module.linkLibrary(imgui);

Usage

zgui.init(gpa)
zgui.backend.init( zgui.backend.ImGui_ImplVulkan_InitInfo{
    \\ ...
    },
    self.window,
);

Error

renderer-run
└─ run exe renderer
   └─ compile exe renderer Debug native 3 errors
error: undefined symbol: _ImGui_ImplGlfw_InitForVulkan
    note: referenced by .zig-cache/o/2c56902be150a7dd0b46efee7c3f0280/renderer_zcu.o:_backend_glfw.initVulkan
error: undefined symbol: _ImGui_ImplVulkan_CreateFontsTexture
    note: referenced by .zig-cache/o/2c56902be150a7dd0b46efee7c3f0280/renderer_zcu.o:_backend_vulkan.init
error: undefined symbol: _ImGui_ImplVulkan_Init
    note: referenced by .zig-cache/o/2c56902be150a7dd0b46efee7c3f0280/renderer_zcu.o:_backend_vulkan.init
error: the following command failed with 3 compilation errors:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions