Unable to declare a const static int vairable ???
-
I have my ATL built CoClass. In its header file i have:
static const int MAX_SPEED = 500;
But the compiler refuses to compile and throw me this freaking error.c:\documents and settings\antonz\desktop\anton\c++ tests\atlcarserver\atlcocar.h(41) : error C2258: illegal pure syntax, must be '= 0'
:confused: Can anybody enlighten an idiot. X| -
I have my ATL built CoClass. In its header file i have:
static const int MAX_SPEED = 500;
But the compiler refuses to compile and throw me this freaking error.c:\documents and settings\antonz\desktop\anton\c++ tests\atlcarserver\atlcocar.h(41) : error C2258: illegal pure syntax, must be '= 0'
:confused: Can anybody enlighten an idiot. X| -
I have my ATL built CoClass. In its header file i have:
static const int MAX_SPEED = 500;
But the compiler refuses to compile and throw me this freaking error.c:\documents and settings\antonz\desktop\anton\c++ tests\atlcarserver\atlcocar.h(41) : error C2258: illegal pure syntax, must be '= 0'
:confused: Can anybody enlighten an idiot. X|ISO C++ allows 'static const' variables as class members, as:
// Either in .cpp or in .h.
class MyClass
{
static const _iN = 3;
};But not VC++6. ;P Maxwell Chen
-
I have my ATL built CoClass. In its header file i have:
static const int MAX_SPEED = 500;
But the compiler refuses to compile and throw me this freaking error.c:\documents and settings\antonz\desktop\anton\c++ tests\atlcarserver\atlcocar.h(41) : error C2258: illegal pure syntax, must be '= 0'
:confused: Can anybody enlighten an idiot. X|At the risk of annoying whoever posted on this subject yesterday:
enum { MAX_SPEED = 500 };
The ability to initialise a constant within the class declaration was added to C++ quite late in the standardisation process, and VC6 doesn't support it. Stability. What an interesting concept. -- Chris Maunder