How do I use C++ in flex and bison?

后端 未结 5 1567
清歌不尽
清歌不尽 2020-12-16 06:03

I have a project for school where we need to use flex and bison. I want to use C++ so that I have access to STL and my own classes that I wrote. We were provided with the fo

5条回答
  •  难免孤独
    2020-12-16 06:46

    Use either a C Compiler or a C++ compiler but not both (till you know what you are upto). You are sure to shoot yourself many times on both your feet otherwise. Mixing gcc and g++ isn't good.

    This line is suspect:

    lex.yy.o: scan.l parse.tab.h attr.h      # added this ...
    gcc -c -o lex.yy.o lex.yy.c
    

    Also, you don't seem to be using CC anywhere, using that'd have made life easier.

    Assuming you don't change a single line of the C code, you will possibly hit some errors and quite a few warnings (like deprecated headers etc). You'll have to fix them as well.

提交回复
热议问题