Comments (6)
https://github.com/cimgui/cimgui#generate-binding
from c-for-go.
@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.
from c-for-go.
At least one of your files should have CIMGUI_DEFINE_ENUMS_AND_STRUCTS
define set.
from c-for-go.
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!
from c-for-go.
Undefined symbols for architecture x86_64:
Linking flags are missing, e.g. #cgo LDFLAGS
or .c
sources that contain those symbols.
from c-for-go.
Hi, I was wondering if there was a demo to understand how to use the binding generator? Thanks!
from c-for-go.
Related Issues (20)
- define pointer to function HOT 1
- type C.struct_ in strut and func HOT 1
- How to handle a function returning a struct as value
- Type translation does not respect systems data model HOT 1
- Verbose argument to print more logs
- Avoid lock / unlock for some function call
- Wiki need to be updated
- panic: unknown type _Float128 HOT 2
- Non int return function pointer not recognized
- Generator uses underlying type of typedef when used as a parameter
- Website down HOT 3
- It would be nice to at least have an example of the YML required in the readme since the website does not work HOT 1
- build HOT 5
- [OS X / Ubuntu ARM64] include file not found: <string> HOT 3
- Extracting SAL annotations from declarations HOT 2
- Example where C const get translated into Go typed const
- Callback generation HOT 2
- THIS IS NOT AN ISSUE!!!
- Avoid symbol lookup error
- Passing in an array to a C function and reading the data - incorrect autogenerated Go code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c-for-go.