C++, BISON, and M4

Discussion in 'C++' started by pendell@hotmail.com, Oct 3, 2007.

  1. Guest

    Okay.

    So I've just installed Fedora core 7 fresh from my machine. It comes
    with G++, and bison installed directly.

    So I try to make a program that uses bison. C++ chokes with the
    error:

    dimensions_dat.cc:1: error: expected constructor, destructor, or type
    conversion before '(' token

    Looking at the first line of dimensions_dat.cc, I find the following:


    b4_copyright(Skeleton parser CASA Grammar Parsing with Bison,
    1984, 1989, 1990, 2000, 2001, 2002)

    Commenting this line out, the error goes away.

    So just comment it out and go merrily on my way, right? Nope! There
    are several uses of macros very like this one, in very hard-to-reach
    places in the code. Far better just to get the macros working in the
    first place.

    Macros -- right. Looking around, I found that these are m4 macros
    (used with the m4 preprocessor) define in /usr/share/bison/c.m4 .

    I think what is *supposed* to happen is that c++ is supposed to run
    the m4 processor first before doing anything else. These macros are
    replaced by standard code, which is then properly compiled.

    However, for some reason m4 is not replacing the macro calls. Either
    it doesn't know where the macros are, or the macros are mis-defined
    and being rejected. Since these are standard Bison definitions which
    I have not touched, I find that highly unlikely.


    Suggestions? Insight? If you don't know, where would I ask to find
    out?

    --
    Respectfully,

    Brian P.
    , Oct 3, 2007
    #1
    1. Advertising

  2. red floyd Guest

    wrote:
    > Okay.
    >
    > So I've just installed Fedora core 7 fresh from my machine. It comes
    > with G++, and bison installed directly.
    >
    > So I try to make a program that uses bison. C++ chokes with the
    > error:
    >
    > dimensions_dat.cc:1: error: expected constructor, destructor, or type
    > conversion before '(' token
    >
    > Looking at the first line of dimensions_dat.cc, I find the following:
    >
    >
    > b4_copyright(Skeleton parser CASA Grammar Parsing with Bison,
    > 1984, 1989, 1990, 2000, 2001, 2002)
    >
    > Commenting this line out, the error goes away.
    >
    > So just comment it out and go merrily on my way, right? Nope! There
    > are several uses of macros very like this one, in very hard-to-reach
    > places in the code. Far better just to get the macros working in the
    > first place.
    >
    > Macros -- right. Looking around, I found that these are m4 macros
    > (used with the m4 preprocessor) define in /usr/share/bison/c.m4 .
    >
    > I think what is *supposed* to happen is that c++ is supposed to run
    > the m4 processor first before doing anything else. These macros are
    > replaced by standard code, which is then properly compiled.
    >
    >

    No, g++ does not call m4. Check your makefile

    >
    > Suggestions? Insight? If you don't know, where would I ask to find
    > out?
    >


    Suggestion: ask in a GNU newsgroup. Try gnu.g++.help
    red floyd, Oct 3, 2007
    #2
    1. Advertising

  3. On 2007-10-03 21:40, wrote:
    > Okay.
    >
    > So I've just installed Fedora core 7 fresh from my machine. It comes
    > with G++, and bison installed directly.
    >
    > So I try to make a program that uses bison. C++ chokes with the
    > error:


    If you have a problem with a specific program, post your problems in a
    group/mailing-list discussing that program. Often the code comes with
    files such as README or similar that will tell you how to configure and
    build it, look for those files and read carefully.

    --
    Erik Wikström
    =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=, Oct 4, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Heathcote

    Problem with flex++/bison++

    Tom Heathcote, Nov 26, 2003, in forum: C++
    Replies:
    0
    Views:
    856
    Tom Heathcote
    Nov 26, 2003
  2. Replies:
    2
    Views:
    486
    Sherm Pendley
    Sep 7, 2005
  3. Replies:
    4
    Views:
    1,098
  4. Replies:
    2
    Views:
    1,559
    Peter
    Mar 2, 2007
  5. Replies:
    0
    Views:
    341
Loading...

Share This Page