error: expected ')' before '(' token in #define

Asked by jovm

I have this code:

#define GPIOF_BASE ((((uint32_t)0x40000000) + 0x00020000) + 0x1400)

And I get this compiler error:

error: expected ')' before '(' token

What seems to be the problem?

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
jovm
Solved:
Last query:
Last reply:
Revision history for this message
jovm (aileen-van-montfort) said :
#1

I routed the error to this:

error: expected ')' before numeric constant
       [cc] #define PERIPH_BASE ((uint32_t)0x40000000) /*!< Peripheral base address in the alias region

Revision history for this message
jovm (aileen-van-montfort) said :
#2

My bad: I mixed defines with typedefines!!

Revision history for this message
Uwe Bonnes (bon) said :
#3

The ST Microelectronic people did a bad decision to use a type cast in their defines. I stumbled on that nonsense on several occasions.

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#4

Hi Jovm,

Do you include stdint.h before this define?

Best regards,

Thomas

Revision history for this message
jovm (aileen-van-montfort) said :
#5

@Thomas. Nope! I was using defines as typedefines. The 'type' is elementary.