The error below reports that the C++ generated class Location lacks the variables 'last_line' and 'last_column'. g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"cs507_EC\" -DVERSION=\"0.1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -I../../src -O2 -c -o parser.o `test -f parser.cpp || echo './'`parser.cpp parser.cpp: In member function `virtual int yy::Parser::parse()': parser.cpp:116: error: `name_' undeclared (first use this function) parser.cpp:116: error: (Each undeclared identifier is reported only once for each function it appears in.) parser.cpp:169: error: 'struct yy::Location' has no member named 'last_line' parser.cpp:169: error: 'const struct yy::Location' has no member named ' last_line' parser.cpp:169: error: 'struct yy::Location' has no member named 'last_column' parser.cpp:169: error: 'const struct yy::Location' has no member named ' last_column' Reproducible: Always Steps to Reproduce: 1. Generate parser.cpp and parser.hpp using "bison -d -S lalr1.cc -o parser.cpp parser.y" 2. Compile parser.cpp: g++ parser.cpp Actual Results: parser.cpp: In member function `virtual int yy::Parser::parse()': parser.cpp:116: error: `name_' undeclared (first use this function) parser.cpp:116: error: (Each undeclared identifier is reported only once for each function it appears in.) parser.cpp:169: error: 'struct yy::Location' has no member named 'last_line' parser.cpp:169: error: 'const struct yy::Location' has no member named ' last_line' parser.cpp:169: error: 'struct yy::Location' has no member named 'last_column' parser.cpp:169: error: 'const struct yy::Location' has no member named ' last_column' parser.cpp: At global scope: parser.cpp:386: warning: initialization of negative value `-1' to `const unsigned char' parser.cpp:386: warning: argument of negative value `-1' to `unsigned char' Expected Results: File compiled without errors or warnings. Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.4.22-Libertos) ================================================================= System uname: 2.4.22-Libertos i686 Pentium III (Katmai) Gentoo Base System version 1.4.3.13 distcc 2.12.1 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ccache version 2.3 [enabled] Autoconf: sys-devel/autoconf-2.58-r1 Automake: sys-devel/automake-1.8.3 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=pentium3 -O3 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=pentium3 -O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache fixpackages sandbox" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" USE="X alsa apm arts avi berkdb bonobo cdr crypt cups curl doc encode esd flash foomaticdb gd gdbm gif gnome gpm gtk gtk2 gtkhtml guile imlib java jpeg kde ldap libg++ libwww mad mikmod mmx motif mozilla mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl php plotutils png python qt quicktime readline sdl slang snmp spell ssl svga tcltk tcpd tetex truetype x86 xml2 xmms xv zlib" bison version: sys-devel/bison-1.875 +nls -static 0 kB [POSSIBLE FIX] The skeleton lalr1.cc lacks the variables 'last_line' and 'last_column'. Adding the lines below to the skeleton fixes the problem. int last_line; int last_column;
Created attachment 28715 [details] Bison grammar file which causes the error to appear
bison-1.875d seems to work fine ... i grabbed your attachment, renamed it to parser.y, ran bison on it like you suggested, and compiled the resulting .cpp with gcc-3.4.3