0
votes

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 
2
You might want to include the line that triggered the error along with a couple of lines before and after it in your post.David Holm
here is the lines that gives the error: #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endifJanaka
any particular reason why you're using an ancient and obsolete piece of junk like VC6?jalf

2 Answers

1
votes

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.

0
votes

YY_PROTO is a macro that is defined earlier in the same file, so something odd is going on near the macro definition. Search earlier in the file to see how YY_PROTO is defined -- if its not getting defined, your compiler is doing something very weird.