views:

203

answers:

1

When i use bison & flex with vc6, i got got below errors

lex.yy.c(395) : error C2146: syntax error : missing ';' before identifier 'YY_PROTO' lex.yy.c(395) : fatal error C1004: unexpected end of file found

what would be the cause for this?? please help.

Copied from Comment:

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus 
extern "C" int yywrap YY_PROTO(( void )); 
#else
extern int yywrap YY_PROTO(( void )); 
#endif
#endif
+1  A: 

The YY_PROTO macro is only to support old pre-standard C without support for prototypes. You will have hard to find a compiler that does not support that today. That means that as a first debugging step you could try to remove it completely since you want to use prototypes, i.e. modify lex.yy.c to the following:

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap ( void );
#else
extern int yywrap ( void );
#endif
#endif

I know that lex.yy.c is a generated file, so that will not be a permanent fix, but it should at least confirm that the problem is related to the definition of YY_PROTO.

hlovdal