I am getting this error when trying to use a constant defined in a class in one file as an array size in a different file. I am using MSVC 2008.
Here is my code.
.h:
#ifndef GLOBALS_H
#define GLOBALS_H
#include "stdafx.h"
class GlobalVars
{
public:
GlobalVars();
static const long LKNR_STEPS=250;
static const long NR_AXIS=3;
static const long NR_PAR=6;
};
#endif
.cpp:
#include "stdafx.h"
#include "Globals.h"
GlobalVars::GlobalVars()
{
;
}
In separate .cpp file:
#include "Globals.h"
class CSingleFactor
{
public:
CSingleFactor()
{
m_nAxis=0;
};
int m_nAxis;
double m_dData[GlobalVars::LKNR_STEPS];
};
This gives me the following error:
error C2653: 'GlobalVars' : is not a class or namespace name
I have tried it as:
double m_dData[LKNR_STEPS];
But then I get:
error C2065: 'LKNR_STEPS' : undeclared identifier
Any clues?
Thanks