Bug 67277 - Error compiling libclassparser_la.all_cc.cc: "class yyFlexLexer" redefined
Summary: Error compiling libclassparser_la.all_cc.cc: "class yyFlexLexer" redefined
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-05 09:32 UTC by Daniel Richard G.
Modified: 2003-11-05 15:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Bugfix patch against tokenizer.l (1.18 KB, patch)
2003-11-05 09:34 UTC, Daniel Richard G.
Details

Note You need to log in before you can comment on or make changes to this bug.
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 ***.