Why does the following code generate a compile error?
Edit: My original code wasn't clear - I've split the code up into separate files...
First.h
class First
{
public:
static const char* TEST[];
public:
First();
};
First.cpp
const char* First::TEST[] = {"1234", "5678"};
First::First()
{
uint32_t len = sizeof(TEST); // fine
}
Determining the size within the First
class seems fine, however...
Second.h
class Second
{
public:
Second();
};
Second.cpp
#include "First.h"
Second::Second()
{
uint32_t len = sizeof(First::TEST); // error
uint32_t elements = (sizeof(First::TEST) / sizeof(First::TEST[0])); // error
}
I get the following error: 'const char *[]': illegal sizeof operand