[Uml-devel] [Bug 67277] New: Error compiling libclassparser_la.all_cc.cc: "class yyFlexLexer" redefined

Daniel Richard G. skunk at iskunk.org
Wed Nov 5 00:33:17 UTC 2003

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
           Summary: Error compiling libclassparser_la.all_cc.cc: "class
                    yyFlexLexer" redefined
           Product: umbrello
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: umbrello-devel at kde.org
        ReportedBy: skunk at iskunk.org

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.

More information about the umbrello-devel mailing list