<pa******@gmail.comwrote in message news:11**********************@m73g2000cwd.googlegr oups.com...
Hello,
Please excuse me as Iam not posting this to correct group. I
have a parser code obtained from flex command. I have many other files.
When I compile them Iam getting a message like: undefined symbol yylex.
What might have went wrong?
Compilers don't give error messages like that. That's a linker
error. Your files all compiled fine, but the linker couldn't
find something to link symbol yylex to. This can occur if you
list the flex library on the gcc command line, even if you're
not actually using flex in program. One thing that can cause
that is, you tell gcc to compile and link a bunch of modules
to an executable, but forget to include the module with main().
For example, when I try to make an exe file out of a blank cpp
file, like so:
// Begin blank.cpp
// (no content)
// End blank.cpp
gpp blank.cpp -lfl -o blank.exe
Error: in function "_main": libmain.c:11: Undefined reference
to symbol "_yylex". Collect2: ld returned 1 exit status.
What happened is, gcc sees that you mentioned the flex library,
so it assumes you want main() generated for you, and a reference
in main to a (non-existant) yylex funtion. Since you never
provided an actual flex file, there IS NO SUCH FUNCTION. So,
you get that error.
So, look to make sure you actually do have a main() function.
More generally, look for files you may have forgotten to include
in the build.
--
Cheers,
Robbie Hatley
East Tustin, CA, USA
lone wolf intj at pac bell dot net
(put "[usenet]" in subject to bypass spam filter)
http://home.pacbell.net/earnur/