I am trying to create a structure containing several arrays of strings inside it. For my purposes, I wanted to use std :: string arrays, but char * arrays would also work if they could do the job. In any case, I cannot figure out how to initialize things. This is what I have:
initialize.h
#include <string>
struct myStruct
{
std::string x[22];
std::string y[8];
};
extern myStruct data[22];
myform.cpp
#include <initialize.h>
#include <string>
myStruct data[22];
data[0].x = {"a", "b", "c", "d", ...};
I get errors that look like this:
Error 1 error C2059: syntax error: '{' Error 2 error C2143: syntax error: missing ';' before '{' Error 3 error C2143: syntax error: missing ';' before '}'
I tried various permutations with char * or std :: string * arrays, but to no avail, I was pretty stuck. Did I forget something fundamental?
Thanks in advance.