help-bison
[Top][All Lists]
Advanced

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

Re: Bison complains about undefined reference of my own data type


From: Hans Aberg
Subject: Re: Bison complains about undefined reference of my own data type
Date: Wed, 26 Nov 2008 15:15:20 +0100

On 23 Nov 2008, at 17:48, sgaurelius wrote:

I am a newbie in bison, so I don't know all the secrets. I used for a while a standard example with its own data type and now I want to include my own. I
included the header file, but the compiler throws me an exception for
undefined reference. However, this is not true, the implementation of the function of my data types class are in the cpp file. The explanation I can
give is the following.

The example's data type was in a header file, let's say example.h. The
implementation was in the same .h file, so it worked. My data type's
implementation is in a separate .cpp file. So, there is some problem for
bison to recognize .cpp files? Maybe, because it is in C and not C++ ?

Your .yy file needs to contain something like

class semantic_type {
public:
  ,,,
  semantic_type() : number_(0) {}
};

#define YYSTYPE semantic_type

and also #include's for headers that the parser might need.

  Hans






reply via email to

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