make
在此代码上运行以使用 DevkitARM 为 GBA 进行交叉编译会产生以下结果:
main.c
tilemap.c
linking cartridge
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/bin/ld: tilemap.o:/home/shuffles/repos/_gba_dev/catsvsrats/include/raw/images/gui/map/tiles25.h:14: multiple definition of `TILES25_IMAGE'; main.o:/home/shuffles/repos/_gba_dev/catsvsrats/include/raw/images/gui/map/tiles25.h:14: first defined here
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/bin/ld: tilemap.o:/home/shuffles/repos/_gba_dev/catsvsrats/include/raw/tilemap_data.h:11: multiple definition of `TILEMAP'; main.o:/home/shuffles/repos/_gba_dev/catsvsrats/include/raw/tilemap_data.h:11: first defined here
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/bin/ld: tilemap.o:/home/shuffles/repos/_gba_dev/catsvsrats/include/raw/images/gui/map/tiles25.h:337: multiple definition of `TILES25_PALETTE'; main.o:/home/shuffles/repos/_gba_dev/catsvsrats/include/raw/images/gui/map/tiles25.h:337: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitARM/gba_rules:25: /home/shuffles/repos/_gba_dev/catsvsrats/catsvsrats.elf] Error 1
make: *** [Makefile:121: build] Error 2
尽管链接器抱怨重复定义,但我在代码中没有发现任何内容,并且所有头文件都有#include 保护。任何信息都有帮助。