Some code.cpp file contains
extern const int v1;
extern const int v2;
extern const int v3;
extern const int v4;
int _tmain(int argc, _TCHAR* argv[])
{
int aee = v1;
switch (aee)
{
case v1:
break;
case v2:
break;
case v3:
break;
case v4:
break;
}
return
}
Another file definition.cpp contains
const int v1 = 1;
const int v2 = 2;
const int v3 = 3;
const int v4 = 4;
When I do compile I got error C2051: case expression not constant However when I remove extern everything is just fine.
Is there any way to make it work with extern?