cancel
Showing results for 
Search instead for 
Did you mean: 

Question about redefinition

eschl
Associate

Hi all,

just a short question:

Why does the compiler say that the page is redefined?

#define ADDR_FLASH_PAGE_148   ((uint32_t)0x0804A000)
#define ADDR_FLASH_PAGE_149   ((uint32_t)0x0804A800)

Same page but with small letters and that's ok for the compiler.

#define ADDR_FLASH_PAGE_148   ((uint32_t)0x0804a000)
#define ADDR_FLASH_PAGE_149   ((uint32_t)0x0804a800)

I've got hundreds of warnings within my defines beacuse of that.

Can anyone explain that to me?

Regards,

Enrico

4 REPLIES 4

It's not the compiler who says that, but the preprocessor.

And it's because the preprocessor is [mostly] a textual processor, it does not understand what's in the macro; so all it can do is to compare the text. And, as C is generally case sensitive, "((uint32_t)0x0804A000)" and "((uint32_t)0x0804a000)" are not the same.

JW

Ozone
Lead II

Check surrounding # if / # ifdef preprocessor directives.

The multiple sections are probably for different variants, and the compiler is supposed to see only one, by chosing the proper variant define.

Another area where cube creates kind of a hefty mess.

eschl
Associate

​Okay, thank you.

I thought the prepropressor had an issue while comparing

#define ADDR_FLASH_PAGE_148   ((uint32_t)0x0804A000)
#define ADDR_FLASH_PAGE_149   ((uint32_t)0x0804A800) 

and stopping the comparison after the capital letter. Because the two pages have different addresses and I thought the type of letters doesn't matter for the comparison.

It would need to be identical to be the same.

Perhaps it indicates files/lines for the conflicts? You could also find-in-files or grep, and then eliminate the conflicts.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..