Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple definition of `gImGuiUserEventCallback' #28

Closed
traw opened this issue Sep 29, 2017 · 3 comments
Closed

multiple definition of `gImGuiUserEventCallback' #28

traw opened this issue Sep 29, 2017 · 3 comments

Comments

@traw
Copy link

traw commented Sep 29, 2017

I am using CMake to compile imgui with SDL-bindings, It give following error

../CMakeFiles/IMGUI_OBJS.dir/imgui-Flix01/imgui.cpp.o:(.bss+0x1f0): multiple definition of `gImGuiUserEventCallback'
CMakeFiles/Proj.dir/app.cpp.o:(.data+0xb0): first defined here
collect2: error: ld returned 1 exit status
src/CMakeFiles/Proj.dir/build.make:585: recipe for target 'bin/Proj' failed
make[2]: *** [bin/Proj] Error 1
CMakeFiles/Makefile2:196: recipe for target 'src/CMakeFiles/Proj.dir/all' failed
make[1]: *** [src/CMakeFiles/Chokidar.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

If I comment line number 20 of imguibindings.cpp

//ImImplVoidDelegateTakingVoidPtr gImGuiUserEventCallback = NULL;

it works fine. I think it's consequence of extern keyword.

@Flix01
Copy link
Owner

Flix01 commented Sep 29, 2017

This is a duplicate of #22 (you should have reopened that).

Anyway, there's only only definition of ImImplVoidDelegateTakingVoidPtr gImGuiUserEventCallback = NULL;, and it's at line number 20 of imguibindings.cpp.

If you have multiple definitions, it means you have defined it somewhere else (for example in your file: app.cpp).

Can you try to:
option (1): declare it extern in app.cpp, or
option (2): just include imguibindings.h from app.cpp, removing the additional declaration of gImGuiUserEventCallback from it
and see if it works ?

Otherwise you must have compiled imguibindings.cpp twice (maybe included from multiple cpp files). Can you check it please ?

@traw
Copy link
Author

traw commented Oct 18, 2017

Thanks I'll look check that

@traw
Copy link
Author

traw commented Oct 18, 2017

Thanks for pointing it out I just check I have defined it in my application.

@traw traw closed this as completed Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants