JIC-CSB / kilombo

Kilobot simulator in C
Other
44 stars 16 forks source link

multiple definitions of 'call_back_json' error #53

Open juliajmg opened 3 years ago

juliajmg commented 3 years ago

Hi!

I installed kilombo in linux, but when I try to compile a program I get this error:

make # gcc -lsim -lSDL -lm -ljansson -o orbit orbit.o /usr/bin/ld: /usr/local/lib/libsim.a(stateio.c.o):/home/ju/kilombo/src/stateio.c:14: multiple definition of `callback_json_state'; /usr/local/lib/libsim.a(skilobot.c.o):/home/ju/kilombo/src/skilobot.c:31: first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:110: orbit] Error 1

I had kilombo installed in my previous laptop (with same linux system) and it worked fine. Hope you can help me!

fjansson commented 3 years ago

That's strange. I just tested compiling the master branch, and didn't see this error. But I do agree that callback_json_state looks like it's defined twice. Can you change kilombo/src/stateio.c, line 14 to extern json_t* (*callback_json_state) (void); i.e. add the word extern, and try again?

Which gcc and ld versions do you have? (do gcc --version and ld --version)

juliajmg commented 3 years ago

I changed the function in stateio.c to extern json_t (callback_json_state) (void);, but still same thing happening. Versions: gcc (GCC) 11.1.0 GNU ld (GNU Binutils) 2.36.1

If i compile to the real kilobots (make hex) I get no errors.

Maybe if I uninstall and install kilombo again? I'm just not sure how to properly uninstall. Thanks!