I've declared the static const array in the header and then implemented it in the cpp file but I cannot figure out what is going on.
Subsys.h:
#ifndef _SUBSYS_H
#define _SUBSYS_H
namespace Engines
{
namespace Particles
{
class SubSys : public ISubSys
{
private:
static const int _M[ 3 ];
...
//rest of class
};
}
}
#endif
Subsys.cpp:
#include "Subsys.h"
namespace Engines
{
namespace Particles
{
const int SubSys::_M[ 3 ] =
{
0x80,
0x7f,
0x01
};
}
}
error LNK2001: unresolved external symbol "private static int const * const Engines::Particles::SubSys::_M" (?_M@SubSys@Particles@Engines@@0QBIB)
If I implement the array in the header outside of the class I don't get the LNK2001 error in the application using the static library. I do get LNK4006 when compiling the static library though (i.e. symbol added more than once).
I've also removed the namespaces in the .cpp file and used the full Engines::Particles::SubSys::_M name. The same problem occurs.