I need to write a parser for a regular language. The parser is part of a C++ program, so it's source code goes inside a Qt project (hopefully). The language that should be parsed is a regular one, so I'm going to use flex++ to generate fastest possible parser class.
The problem is that I get errors during compilation. I think it's because of flags. The parser class should compiled and linked with -lfl flag. How do I change my .pro file or project setting for this?
you can use QMAKE_CXXFLAGS for compiler flags and QMAKE_LFLAGS for linker flags in your .pro file.
Add this to your .pro file:
LIBS += -lfl
I tried both. but linker says 'undefined reference to yyFlexLexer::yywrap()' again.
Did you have a look at qmake's "LEXSOURCES":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#lexsources variable?
bq. Did you have a look at qmake’s LEXSOURCES [doc.qt.nokia.com] variable?
No I didn't even know they exist. I read them right now and don't understand how to use them. Could you explain what exactly should I do to obtain lexer class?
I currently put LEXSOURCES = rules.l in project file. so how should I do now?
(Googled around a lot but there is no clear description ! )
Ok that was mistake to put rules file, I should set LEXSOURCES to lex source files. now set LEXSOURCES = lex.yy.cc and have 995 errors.
I'm really confused