> Use -P individually for each and every class that flex generates and read
> the man page of flex:
> If you want to create multiple (different) lexer classes,
> you use the -P flag (or the prefix= option) to rename each
> yyFlexLexer to some other xxFlexLexer. You then can
> include <FlexLexer.h> in your other sources once per lexer
> class, first renaming yyFlexLexer as follows
> If that doesn't help you, you should consider posting the exact error
> messages of your linker. Some flex versions just *on unistd.h stuff
> and then a simple software upgrade would fix your problems (that is, if
> you use an affected Linux distribution, such as RedHat 7.0 for example)
Thanks for the help, but... does not work. I read the man page. Maybe
I am too stupid to understand it... I made a small example, that may
show the problem:
This is the class-include:
---------------------- my scanner class: scan_a.hh ---------------------
#ifndef scan_a
#define scan_a
#undef yyFlexLexer
#define yyFlexLexer a_FlexLexer
#include <FlexLexer.h>
class scana : public a_FlexLexer {
public:
scana();
private:
int yylex();
Quote:};
#endif
------------------------------------------------------------------------
and this is the flex-file:
----------------------- my flex file: scan_a.hh ------------------------
%option c++
%option yyclass="scana"
%{
#include <iostream>
#include "scan_a.hh"
%}
%%
<*>. {
cout << "scan a: " << YYText() << endl;
Quote:}
%%
------------------------------------------------------------------------
Then
flex -+ -8 -Pa_ scan_a.lex
which works fine, and then
c++ lex.a_.cc
which says
In file included from scan_a.hh:6,
from scan_a.lex:6:
/usr/include/FlexLexer.h:103: redefinition of `class a_FlexLexer'
/usr/include/FlexLexer.h:103: previous definition here
/usr/include/FlexLexer.h:184: confused by earlier errors, bailing out
But of course in FlexLexer.h is no class a_FlexLexer defined. If I
omit the undef-define-pair in the class-file, it produces the same
error. So, the problem is, that I am not able to rename the
Lexer-Class and methods.
Thanks
Stephan Kuhagen
--
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
| >>> ...destination anywhere, -\<, |
| >>> east or west, I don't care... (*)/(*) |
| WWW: http://www.veryComputer.com/~stk |
\_______________________________________________/
PS: Ich widerspreche der Nutzung oder Uebermittlung meiner
Daten fuer Werbezwecke oder fuer die Markt- und Meinungsforschung
(28 Abs. 3 Bundesdatenschutzgesetz)