Skip to content

module_imgui.cpp 三元运算符两个分支类型不同导致无法编译 #9

@OppositeNor

Description

@OppositeNor

我现在正在尝试使用 GCC 编译此项目。编译过程中出现了如下错误(示例):

RaycastEngine/module_imgui.cpp:862:184: error: operands to ‘?:’ have different types ‘luabridge::LuaRef’

问题出在 module_imgui.cpp 文件中,有多个从 luabridge::LuaRef 在三元运算符中被隐式转换为 int,导致编译错误。例如:

.addFunction("ColorPicker4", +[](const char* label, ImColor& color, luabridge::LuaRef flags) { return ImGui::ColorPicker4(label, &color.Value.x, flags ? flags : 0); })

应当被修改为:(在 flag 处添加 static_cast<int>

.addFunction("ColorPicker4", +[](const char* label, ImColor& color, luabridge::LuaRef flags) { return ImGui::ColorPicker4(label, &color.Value.x, flags ? static_cast<int>(flags) : 0); })

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