469,270 Members | 1,244 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

i got "error C2099: initializer is not a constant" need help

montzter
Hi,

Got some declarations below but when I compiled it I got the above mentioned error.
1. I'd like to know if my implementation or stucture is doable.
2. How could i fix the problem...? Suggestions?

Thanks.

//code
typedef struct SomeStructTag
{
char* vOrigString;
char* vDestinationString;
void (*pfnFuncPtr)(char* a, char* b);
}SomeStructType;

//*******************************************
static SomeStructType globalVar[] =
{
((char*)"N", (char*)"Name :", SomeHandleFunction1),
((char*)"F", (char*)"Frog :", SomeHandleFunction2)
};
Dec 13 '06 #1
2 4426
horace1
1,510 Expert 1GB
try replaceing () with {}, e.g.
Expand|Select|Wrap|Line Numbers
  1. static SomeStructType globalVar[] =
  2. {
  3. {(char*)"N", (char*)"Name :", SomeHandleFunction1},
  4. {(char*)"F", (char*)"Frog :", SomeHandleFunction2}
  5. };
  6.  
  7.  
Dec 13 '06 #2
try replaceing () with {}, e.g.
Expand|Select|Wrap|Line Numbers
  1. static SomeStructType globalVar[] =
  2. {
  3. {(char*)"N", (char*)"Name :", SomeHandleFunction1},
  4. {(char*)"F", (char*)"Frog :", SomeHandleFunction2}
  5. };
  6.  
  7.  

Waaaaaaaaaaaaaah. I missed that one. Thanks!!!!
Dec 15 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Charlie | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.