greenfork / nimraylib_now

The Ultimate Raylib gaming library wrapper for Nim
MIT License
149 stars 16 forks source link

Multiple definition of raygui functions #92

Open the-argus opened 1 year ago

the-argus commented 1 year ago

Related to #49 I think, it's basically the same problem but with raygui.

Issue

Using raygui causes multiple definition errors for symbols defined in raygui headers.

Steps to reproduce

Clone https://github.com/the-argus/hampster-game at commit af08b1f61a02b89bf12d19aca6e2dca52bf0c9e7 and run nimble build -d:nimraylib_now_shared --threads=on (I used the shared lib since I'm on nixOS). Alternatively, if you have nix installed, just enter the directory and run nix run.

Error log

I'm not going to paste the whole thing, but its just this over and over for all the raygui functions:

Output: /nix/store/lz1bwpdvlywij5ir0fmncgqa83dlpwhn-binutils-2.39/bin/ld: /home/argus/.cache/nim/hampster_game_d/@mhampster_game.nim.c.o: in function `GuiEnable':
        ... @mhampster_game.nim.c:(.text+0x0): multiple definition of `GuiEnable'; /home/argus/.cache/nim/hampster_game_d/@mui.nim.c.o:@mui.nim.c:(.text+0x0): first defined here
        ... /nix/store/lz1bwpdvlywij5ir0fmncgqa83dlpwhn-binutils-2.39/bin/ld: /home/argus/.cache/nim/hampster_game_d/@mhampster_game.nim.c.o: in function `GuiDisable':
        ... @mhampster_game.nim.c:(.text+0x11): multiple definition of `GuiDisable'; /home/argus/.cache/nim/hampster_game_d/@mui.nim.c.o:@mui.nim.c:(.text+0x11): first defined here
        ... /nix/store/lz1bwpdvlywij5ir0fmncgqa83dlpwhn-binutils-2.39/bin/ld: /home/argus/.cache/nim/hampster_game_d/@mhampster_game.nim.c.o: in function `GuiLock':
        ... @mhampster_game.nim.c:(.text+0x22): multiple definition of `GuiLock'; /home/argus/.cache/nim/hampster_game_d/@mui.nim.c.o:@mui.nim.c:(.text+0x22): first defined here
greenfork commented 1 year ago

I guess I will have to prioritize the re-write to a single C file. This issue seems to be too ubiquitous. Thank you for this bug report!