[utilisation de constante] erreur C2051
ma declaration de constante (dans une classe, file :Icom.h)
Code:
1 2 3 4 5 6 7 8 9
|
class ICom: public CObject
{
public://RTC Type Size
static const int c_rtc_BOOLSIZE ;
static const int c_rtc_UINTSIZE ;
static const int c_rtc_UDINTSIZE;
} |
mon initialisation de constante (hors d'une methode de classe, file ICom.cpp)
Code:
1 2 3
| const int ICom::c_rtc_BOOLSIZE =1;
const int ICom::c_rtc_UINTSIZE =2;
const int ICom::c_rtc_UDINTSIZE =4; |
Erreur genérée (3x) C2051 : l'expression associée à case n'est pas une constante
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| switch(_pLength)
{
case ICom::c_rtc_BOOLSIZE: //1 byte
break;
case ICom::c_rtc_UINTSIZE: //2 bytes
break;
case ICom::c_rtc_UDINTSIZE: //4 bytes
break;
default:
break;
} |
je ne comprend pas pourquoi le compilateur ne vois pas mes constantes comme des constantes...
des idées ???