BlinkyStitt / Splatoon-2-Drawing

Proof-of-Concept LUFA Project for the Nintendo Switch. Pretends to be a HORI Pokken Pad which only prints Splatoon 2 Posts
Other
12 stars 1 forks source link

"image_data" multiple definition #2

Open WesternGun opened 6 years ago

WesternGun commented 6 years ago

I see an error:

 [LNK]     : Linking object files into "Joystick.elf"
avr-gcc Joystick.o Descriptors.o image.o ../LUFA/LUFA/Drivers/USB/Class/Common/HIDParser.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.o ../LUFA/LUFA/Drivers/USB/Core/ConfigDescriptors.o ../LUFA/LUFA/Drivers/USB/Core/DeviceStandardReq.o ../LUFA/LUFA/Drivers/USB/Core/Events.o ../LUFA/LUFA/Drivers/USB/Core/HostStandardReq.o ../LUFA/LUFA/Drivers/USB/Core/USBTask.o -o Joystick.elf -lm -Wl,-Map=Joystick.map,--cref -Wl,--gc-sections-Wl,--relax -mmcu=atmega32u4
image.o:(.progmem.data+0x0): multiple definition of `image_data'
Joystick.o:(.progmem.data+0x0): first defined here
e:/coding/environment/winavr/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
make: *** [Joystick.elf] Error 1

It seems like in image.c there is a image_data defined same as in Joystick.c, repeated name. image.c:

const uint8_t image_data[0x12c1] PROGMEM = {...}

Joystick.c:

const uint8_t image_data[0x12c1] PROGMEM;

I changed the name in Joystick.c to something else and error gone, it compiles well. Should this be the fix? I am not sure because I am not familiar with C.

WesternGun commented 6 years ago

No, it is not.

I google a bit and then look into this repo of:

https://github.com/LightningStalker/Splatmeme-Printer

which works totally for me, where it has Joystick.c like extern const. So it should be the fix.