Bug 67277

Summary: Error compiling libclassparser_la.all_cc.cc: "class yyFlexLexer" redefined
Product: [Applications] umbrello Reporter: Daniel Richard G. <skunk>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Bugfix patch against tokenizer.l

Description Daniel Richard G. 2003-11-05 09:32:11 UTC
Version:           current CVS (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.3.2 (Debian)
OS:          Linux

Compiling kdesdk/umbrello/umbrello/classparser/libclassparser_la.all_cc.cc gives the following error:

    In file included from ClassParser.h:31,
                     from ClassParser.cc:20,
                     from libclassparser_la.all_cc.cc:17:
    /usr/include/FlexLexer.h:112: error: redefinition of `class yyFlexLexer'
    /usr/include/FlexLexer.h:112: error: previous definition of `class yyFlexLexer'

followed by various others.

The problem is that the FlexLexer.h header has a strange way of handling multiple inclusions of 
itself. tokenizer.l (tokenizer.cc) and ClassParser.cc both include this header indirectly, and in separate compilation they work fine; but when compiling concatenated source, a "#define yyFlexLexer yyFlexLexer" declaration (inserted by flex) carries through from tokenizer.cc to ClassParser.cc, and causes havoc on the second inclusion. (In the error message quoted above, the two FlexLexer.h lines are the second and first inclusions, respectively.)

The/A solution is to "#undef yyFlexLexer" at the end of tokenizer.l, and I will attach a patch that does this with an explanation why.
Comment 1 Daniel Richard G. 2003-11-05 09:34:48 UTC
Created attachment 3034 [details]
Bugfix patch against tokenizer.l

This patch appends "#undef yyFlexLexer" to the end of tokenizer.l (and thereby
tokenizer.cc). Kills the bug.
Comment 2 Sebastian Stein 2003-11-05 15:25:41 UTC
*** Bug has been marked as fixed ***.