|
-
April 10th, 2006, 11:07 AM
#1
What's wrong with this 'const' array decleration?
Code:
static const string Alphabet[] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", x", "y", "z" };
I keep getting the following compilation errors :
d:\projects\handlib\handlib\handlib.h(92) : error C2059: syntax error : '{'
d:\projects\handlib\handlib\handlib.h(92) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
Thanks
BW!
Regards,
Big Winston
-
April 10th, 2006, 11:12 AM
#2
Re: What's wrong with this 'const' array decleration?
.h file:
Code:
#pragmaonce
#include <string>
class A
{
public:
A(void);
~A(void);
staticconst std::string array[];
};
.cpp
Code:
#include ".\a.h"
const std::string A::array[] = {"a", "b"};
A::A(void)
{
}
A::~A(void)
{
}
-
April 10th, 2006, 12:40 PM
#3
Re: What's wrong with this 'const' array decleration?
Well, it's ok, but you missed a double quote here:
Code:
"w", x", "y", "z" };
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|