Open Xzya opened 6 years ago
At least one of your files should have CIMGUI_DEFINE_ENUMS_AND_STRUCTS
define set.
Hello,
I already tried this. Using #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS 1
results in the following error:
# github.com/Xzya/go-imgui/imgui
In file included from imgui/cgo_helpers.go:9:
In file included from ./cgo_helpers.h:4:
./cimgui/cimgui/cimgui.h:84:8: error: redefinition of 'ImVec2'
struct ImVec2
^
./cimgui/cimgui/cimgui.h:84:8: note: previous definition is here
struct ImVec2
^
In file included from imgui/cgo_helpers.go:9:
In file included from ./cgo_helpers.h:4:
./cimgui/cimgui/cimgui.h:89:8: error: redefinition of 'ImVec4'
struct ImVec4
^
./cimgui/cimgui/cimgui.h:89:8: note: previous definition is here
struct ImVec4
^
In file included from imgui/cgo_helpers.go:9:
In file included from ./cgo_helpers.h:4:
./cimgui/cimgui/cimgui.h:96:5: error: redefinition of enumerator 'ImGuiWindowFlags_NoTitleBar'
ImGuiWindowFlags_NoTitleBar = 1 << 0,
^
./cimgui/cimgui/cimgui.h:96:5: note: previous definition is here
ImGuiWindowFlags_NoTitleBar = 1 << 0,
^
In file included from imgui/cgo_helpers.go:9:
In file included from ./cgo_helpers.h:4:
./cimgui/cimgui/cimgui.h:97:5: error: redefinition of enumerator 'ImGuiWindowFlags_NoResize'
ImGuiWindowFlags_NoResize = 1 << 1,
^
...
many errors following the same pattern
...
I thought this was caused because the header was imported multiple times, so I tried adding #pragma once
in the cimgui.h
header, and the error changes to:
# github.com/Xzya/go-imgui/imgui
cgo-gcc-prolog:7306:41: warning: incompatible pointer types passing 'struct __va_list_tag *' to parameter of type 'struct __va_list_tag *' [-Wincompatible-pointer-types]
imgui/cimgui/cimgui/cimgui.h:781:102: note: passing argument to parameter 'args' here
cgo-gcc-prolog:7328:44: warning: incompatible pointer types passing 'struct __va_list_tag *' to parameter of type 'struct __va_list_tag *' [-Wincompatible-pointer-types]
imgui/cimgui/cimgui/cimgui.h:782:105: note: passing argument to parameter 'args' here
# github.com/Xzya/go-imgui/imgui
Undefined symbols for architecture x86_64:
"_ImDrawData_DeIndexAllBuffers", referenced from:
__cgo_3ccdb0436fb9_Cfunc_ImDrawData_DeIndexAllBuffers in imgui.cgo2.o
(maybe you meant: __cgo_3ccdb0436fb9_Cfunc_ImDrawData_DeIndexAllBuffers)
"_ImDrawData_ScaleClipRects", referenced from:
__cgo_3ccdb0436fb9_Cfunc_ImDrawData_ScaleClipRects in imgui.cgo2.o
(maybe you meant: __cgo_3ccdb0436fb9_Cfunc_ImDrawData_ScaleClipRects)
"_ImDrawList_AddBezierCurve", referenced from:
__cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddBezierCurve in imgui.cgo2.o
(maybe you meant: __cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddBezierCurve)
"_ImDrawList_AddCallback", referenced from:
__cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddCallback in imgui.cgo2.o
(maybe you meant: __cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddCallback)
"_ImDrawList_AddCircle", referenced from:
__cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddCircle in imgui.cgo2.o
(maybe you meant: __cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddCircleFilled, __cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddCircle )
"_ImDrawList_AddCircleFilled", referenced from:
__cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddCircleFilled in imgui.cgo2.o
(maybe you meant: __cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddCircleFilled)
"_ImDrawList_AddConvexPolyFilled", referenced from:
__cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddConvexPolyFilled in imgui.cgo2.o
(maybe you meant: __cgo_3ccdb0436fb9_Cfunc_ImDrawList_AddConvexPolyFilled)
...
many errors following the same pattern
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Compilation finished with exit code 2
My guess is that CIMGUI_DEFINE_ENUMS_AND_STRUCTS
is only intended to be used when generating code. E.g. I am using it when generating the code with c-for-go because it doesn't see the type declarations from the C++ code (imgui.h
).
Any ideas? Thank you!
Undefined symbols for architecture x86_64:
Linking flags are missing, e.g. #cgo LDFLAGS
or .c
sources that contain those symbols.
Hi, I was wondering if there was a demo to understand how to use the binding generator? Thanks!
@yaswagner instead of writing a generator that consumes cimgui's JSON (as @sonoro1234 suggests, right?), I'd use c-for-go
with a generated cimgui.h
.
There is a plenty examples in the repo, see Nuklear and Vulkan bindings, both are made for a single-file API header.
@yaswagner regarding to errors above, I fixed c-for-go
a couple of days ago, it should avoid duplicates. Please try again.
Hello,
I am trying to write bindings for imgui (cimgui) but I run in all kinds of problems, and I'm not sure what I'm doing wrong.
Here is my code, and I also have this test project with the minimal code to reproduce the problem.
Current I am getting the following errors:
and
I am not very familiar with C/C++, so there may be something very obvious that I am doing wrong.
Could you provide some help please?
Thank you!