Suppose I have the following sample header file test.h

Code:
#include "myCommon.h"

class Test
{
public:
  Test();

  vector<vector<vector<double>>> vI3(dim1, vector<vector<double>> (dim2, vector<double> (dim2, 0.0f)));

private:
  fillVector();
}
In above test.h dim1 and dim2 are defined in a different header file, i.e. myCommon.h

Code:
const long dim1 = 40;

enum dimVector {
  RED,
  GREEN,
  dim2
};
However, it gives the errors when I compile: variable "dim1" is not a type name and for variable "dim2" it complains about a duplicate parameter name. Any solutions?

The declarations of dim1 and dim2 should stay in myCommon.h. They can also be defined in myCommon.cpp if needed, but can't go into test.h.

Thanks.