Hi,
I'm getting an error when compiling the following code on gcc 2.95.2 (yes I know it's old, but I'm stuck with it). It compiles fine in Visual Studio though. Can anyone figure out what's going on? If I remove the const from the array definition it will compile, but I want it to be const.
Here's the error:
conversion from `const WordScoreMap[2]' to non-scalar type `WordScoreMap' requested
Thanks.
I'm getting an error when compiling the following code on gcc 2.95.2 (yes I know it's old, but I'm stuck with it). It compiles fine in Visual Studio though. Can anyone figure out what's going on? If I remove the const from the array definition it will compile, but I want it to be const.
Here's the error:
conversion from `const WordScoreMap[2]' to non-scalar type `WordScoreMap' requested
Thanks.
Code:
struct WordScoreMap
{
std::string word;
int score;
};
static const WordScoreMap WORDS[ 3 ][ 2 ] = {
{ WordScoreMap( "one", 10 ), WordScoreMap( "first", 5 ) },
{ WordScoreMap( "two", 10 ), WordScoreMap( "second", 5 ) },
{ WordScoreMap( "three", 10 ), WordScoreMap( "third", 5 ) } };