[OT] Re: problem : yacc v.s c++

Discussion in 'C++' started by John Harrison, Aug 28, 2003.

  1. "Lung Sheng" <> wrote in message
    news:bik31j$751$...
    > Hi,All :
    > i try to write a parser and use tool "lex" for scanner and "yacc" for
    > parser,
    > because i use vector of STL to deal information extracted from parser,
    > g++ is preferable.
    > error message in compilation is
    > -----------------------------------------------
    > Undefined first referenced
    > symbol in file
    > yyerror(char const *) /var/tmp/ccMxgftp.o
    > ld: fatal: Symbol referencing errors. No output written to a.out
    > collect2: ld returned 1 exit status
    > -----------------------------------------------
    > with compiler gcc 2.95.2
    >
    >
    > it seems that linker cannot find the symbol
    > but yyerror is used only in y.tab.c
    > I don't know what this error message means
    >
    > Is any way to fix this problem ?
    >
    > Thanks a lot
    > Lung Sheng
    >
    > ps : The most interesting is when i use another mechine with compiler
    > 2.91.66
    > the program can pass the compilation
    >


    yyerror is defined in the yacc library, but it is usually defined as 'void
    yyerror(char*)', notice there is no const.

    I've seen this before, some versions of yacc aren't very C++ compatible. I
    think the simplest thing would be to define your own version of yyerror, the
    other solution is to edit the parser template file that you are using.

    BTW this is off topic in comp.lang.c++, which only deals with C++ questions,
    not third party libraries. Email me directly if you have any further
    problems, I'll be glad to help if I can.

    john
    John Harrison, Aug 28, 2003
    #1
    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. exits funnel

    Parsing - YACC to java

    exits funnel, Jul 31, 2003, in forum: Java
    Replies:
    3
    Views:
    5,625
    exits funnel
    Jul 31, 2003
  2. Mike Wahler
    Replies:
    2
    Views:
    533
    John Harrison
    Jul 8, 2003
  3. Xose Lois Castro

    Lex / Yacc problem

    Xose Lois Castro, Jan 10, 2008, in forum: C Programming
    Replies:
    1
    Views:
    293
  4. a yacc problem, help!

    , Oct 4, 2008, in forum: C Programming
    Replies:
    1
    Views:
    388
    Nick Keighley
    Oct 6, 2008
  5. Mikel Lindsaar

    RACC and YACC problem in TMail

    Mikel Lindsaar, Oct 21, 2007, in forum: Ruby
    Replies:
    0
    Views:
    127
    Mikel Lindsaar
    Oct 21, 2007
Loading...

Share This Page