gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Odd issues of monkeys and pencils

#108529 - thegamefreak0134 - Thu Nov 09, 2006 10:40 pm

Code:
template.o:(.rodata+0x20): multiple definition of `pencilBitmap\'
pencil.o:(.rodata+0x20): first defined here
template.o:(.rodata+0x0): multiple definition of `pencilPal\'
pencil.o:(.rodata+0x0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [/c/devkitPro/Projects/PaintBASIC/arm9/PaintBASIC.arm9.elf] Error 1
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/devkitPro/Projects/PaintBASIC/arm9\'
\"make\": *** [arm9/PaintBASIC.elf] Error 2


This is what I get when I try to do:

Code:
#include \"pencil.c\"


which has my info for an image. The program itself compiles fine, it just won\'t link. I am very new to makefiles, and I suspect them to be the issue. How is one supposed to add an image to the project in the more generally accepted manner?

-thegamefreak
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]

#108544 - Cearn - Thu Nov 09, 2006 11:51 pm

The problem isn't makefiles, the problem is that you shouldn't #include data. pencil.c contains the definitions of pencilPal and pencilBitmap, so when compiled pencil.o will contain these items. When you #include pencil.c into template.c (or any other file), then that file will also contain a copy of those items. So now the linker will have to choose which version of the data called pencilPal and pencilBitmap you actually mean. And because that's a decision best left to the programmer, it throws out an error message that you should only have one copy of the data in the project.

There should also be a header file with declarations for the arrays, probably called pencil.h. Include that instead of pencil.c, clean the project to make sure the old definitions are gone, and build it again.

#108629 - thegamefreak0134 - Fri Nov 10, 2006 6:07 pm

So there is a reason usenti (or git) can export the headers... OK, that will probably work a lot better. Thanks!
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]