Reputation: 11
/* file.c */
#define PCH_LPC_RCBA_BASE_ADDRESS 0xFED1C000
#define READ_MEM8 (MemAddr) MmioRead8 (MemAddr)
#define READ_MEM8_RCRB (wReg) READ_MEM8 (PCH_LPC_RCBA_BASE_ADDRESS | wReg)
UINT8 IoValue = READ_MEM8_RCRB (0x10);
Got a compiler error error C2065: 'wReg' : undeclared identifier
wReg did not get substituted with 0x10. what did I do wrong?
Upvotes: 0
Views: 134
Reputation: 643
It's a standard Rule not to leave blank between Macro Template and It's Argument.
Do not give space between READ_MEM8_RCRB
and (wReg)
as:
wReg
will be part of Macro Expansion.Upvotes: 2
Reputation: 60037
Remove the space
i.e.
#define PCH_LPC_RCBA_BASE_ADDRESS 0xFED1C000
#define READ_MEM8(MemAddr) MmioRead8 (MemAddr)
#define READ_MEM8_RCRB(wReg) READ_MEM8(PCH_LPC_RCBA_BASE_ADDRESS | wReg)
Upvotes: 0