Omnimaga
Calculator Community => TI Calculators => Calculator C => Topic started by: fb39ca4 on December 07, 2010, 04:40:38 pm
-
What is going on here?
$ make
nspire-gcc -Os -Wall -W -c sprites.c
nspire-ld main.o utils.o game.o graphics.o sprites.o -o particles.elf
sprites.o:(.bss+0x0): multiple definition of `tank'
game.o:(.bss+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [particles.tns] Error 1
-
It looks like you declared a global variable called tanks in sprites.c when there was already a global variable called tanks in game.c
-
Odd ... I never declared anything called tank in game.c. Changing the name in sprites.c worked, though.
Thanks for the help!
Also, I noticed your respect was at +84 ;)
-
Sorry for the double post, but the problem is back again.
Now, after I changed tank to tanksprite in sprites.c and game.c, I get the same error. I am not using a header file for sprites.c, just putting #include "sprites.c" at the top of game.c. Could this be why?
-
Ah yeah, you probably shouldn't be including a .c file. The makefile compiles sprites.c separately, so essentially you are including the sprites.c code twice in the whole project. If you really want to include code, make it a .h file or something.
Edit:
After taking a closer look at the Makefile, I suppose it'll only compile sprite.c separately if you have sprite.o after OBJS in the Makefile. I might be wrong, though.
-
why not change sprites.c to sprites.h? It shouldn't matter (I think), but no program is perfect :P