CPCWiki forum

General Category => Programming => Topic started by: ervin on 09:57, 23 December 21

Title: strange SDCC problem... any suggestions?
Post by: ervin on 09:57, 23 December 21
Hi folks.

I'm working on a little prototype at the moment, and I've run into a weird problem.
I've got a number of #define statements at the top of my main.c file:


#define SPRITE0_16x16_0 0x8600
#define SPRITE0_16x16_1 0x8E00

#define SPRITE0_15x16_0 0x8680
#define SPRITE0_15x16_1 0x8700

#define SPRITE0_16x15_0 0x8780
#define SPRITE0_16x15_1 0x8F00

#define SPRITE0_15X15_0 0xB600
#define SPRITE0_15X15_1 0xB680


Those values are referenced in the following arrays:


u8* const tblSprite_0[]={
SPRITE0_16x16_0,SPRITE0_15x16_0,SPRITE0_16x15_0,SPRITE0_15x15_0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};

u8* const tblSprite_1[]={
SPRITE0_16x16_1,SPRITE0_15x16_1,SPRITE0_16x15_1,SPRITE0_15x15_1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};


When I compile this I get the following error:


$ make
/home/ErvinPajor/cpctelera-development/cpctelera/tools/sdcc-3.6.8-r9946/bin/sdcc -I/home/ErvinPajor/cpctelera-development/cpctelera/src -Isrc -mz80  -c  src/main.c -o  obj/main.rel
src/main.c:170: error 20: Undefined identifier 'SPRITE0_15x15_0'
src/main.c:182: error 20: Undefined identifier 'SPRITE0_15x15_1'
make: *** [/home/ErvinPajor/cpctelera-development/cpctelera//cfg/global_main_makefile.mk:46: obj/main.rel] Error 1


Now the weird thing is that if I remove SPRITE0_15x15_0 and SPRITE0_15x15_1 from the arrays, compilation is successful, and the program behaves as expected.

Does anyone have any suggestions?
Title: Re: strange SDCC problem... any suggestions?
Post by: Jean-Marie on 11:05, 23 December 21
#define SPRITE0_15X15_0 0xB600[/size]#define SPRITE0_15X15_1 0xB680


The letter X is in upper case while it's in lower case here :
u8* const tblSprite_1[]={SPRITE0_16x16_1,SPRITE0_15x16_1,SPRITE0_16x15_1,SPRITE0_15x15_1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};


;D
Title: Re: strange SDCC problem... any suggestions?
Post by: ervin on 11:12, 23 December 21
Oh wow... how embarrassing!!!
I can't believe I did that.

Thanks so much for finding that!
I've spent far too long looking at this, going out of my mind!
:laugh:
Powered by SMFPacks Menu Editor Mod