help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem linking program containing bison-generated parser


From: Laurence Finston
Subject: Re: problem linking program containing bison-generated parser
Date: Fri, 11 Mar 2005 11:07:15 +0100 (MET)

On Thu, 10 Mar 2005, Volker Wegert wrote:

> I'm currently trying to gain some experience with flex and bison.

I've found that I prefer using Flex and Bison separately rather than
together.  If you're just starting out learning Bison, I think you
might find it easier to write your own `yylex()' function rather than
using Flex.

> In one of my
> projects, I'd like to use these two tools together with some Qt classes. I'm
> not trying to create an object-oriented parser, I'm just using Qt's string and
> list objects as I'm much more familiar with them.

Perhaps it would simplify matters if you just used the `string' and `list'
template classes from the C++ Standard Template Library.  You don't need
to generate a C++ parser function.  I just generate an ordinary C parser
function, use C++ in the actions, and compile with `g++'.

> However, I get the following error message during linking (output
> abbreviated):

> | undefined reference to `yyparse()'

>
> So as far as I can see, the function yylex() should be present. Can anybody
> tell me what's going wrong here?

I didn't see an error message about an undefined reference to `yylex()'.
Since you have an undefined reference to `yyparse()', I would check two
things first:

1.  Is `yyparse()' declared in a header file included by all compilation
    units containing a call to it?

2.  Is the object file containing the definition of `yyparse()' included
    in the call to the linker?

Laurence Finston
http://www.gnu.org/software/3dldf/LDF.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]