Question
Cosmic CXSTM8 Comiler Error - Invalid Constant Expression
Posted on July 03, 2011 at 23:15
I'm porting some code designed to run on a Nordic nRF8200 to an STM8L152C6. The code was orginally compiled using Keil C5. I am using the Cosmic CXSTM8 compiler.
I am getting a compiler error 'Invalid Constant Expression' in the CASE: line of a switch statement that I cannot understand. code snippet is included below. switch (pipe_num) { case PIPE_LINK_LOSS_ALERT_ALERT_LEVEL_RX: alert_handle_on_link_loss = (alert_level_t)buffer[0]; break; default: break; } pipe_num is a locally defined uint8_t, and #define PIPE_LINK_LOSS_ALERT_ALERT_LEVEL_RX 6 is declared in an included header file. I cannot understand what the compiler is taking exception to in this case. If anyone could help I'd really appreciate it.