Re: [Flex-help] undefined reference to 'yylex'
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Arthur S. <asc...@at...> - 2014-04-10 14:20:43
|
What I do is to create a separate header file containing a reference to lex(). Such as: // <lex.h> /** *@brief Scanner Name. */ extern int lex( parser::semantic_type* yylval , parser::location_type* yylloc); where I am interfacing to a Bison generated C++ file and a C generated LEX file. In my Bison generated code I include a reference to this header file as in: %{ # include "lex.h" %} where the brackets, %{ and %}, specify where in the generated Bison file to place the include statement. Seems to work. art ________________________________ From: Michele Bert <mic...@gm...> To: fle...@li... Sent: Thursday, April 10, 2014 5:58 AM Subject: Re: [Flex-help] undefined reference to 'yylex' 2014-04-10 11:43 GMT+02:00 liugongquan123 <liu...@16...>: > /usr/local/lib/libfl.so:undefined reference to 'yylex' > collect2:ld returned 1 exit status > As I can see, yylex() is defined in /flex-2.5.39/yylex.c, and "/usr/local/lib/libfl.so " is > installed by flex "make install", why there are such errors,and how to resolve it? As far as I understand, yylex() is the function genereted by flex, so it is not provided by flex libraries themselves. If you write <yourfile>.flex, and run it through flex, it generates <yourfile>.c, which contains the function yylex(). You have to compile that program, and link it to the final package. Is it right? -- Michele ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees _______________________________________________ Flex-help mailing list Fle...@li... https://lists.sourceforge.net/lists/listinfo/flex-help |