I get the following errors on the line with "static const string ...":
error C2059: syntax error : '{'
error C2334: unexpected token(s) preceding '{'; skipping apparent function body
when trying to compile something like this:
#ifndef TEST_H
#define TEST_H
#include <string>
using namespace std;
class Test
{
public:
static const string MYARRAY[] = {"hello", "world"};
};
#endif
I've been messing around with the code for a while now, and can't seem to wrap my head around what's wrong. The header file I'm working on is holding several configurable variables, and are available to the entire project. I'm hoping to keep them static, constant, and initialized at runtime.
Any help is appreciated. Thanks all!