Another update: If I quit playmode on the right side of the rule, the error disappears (it gives warnings of an unused rule instead), code:
init: INIT side NUMBER { driver.h_init_finished( $2, $3, (Playmode)0 ); } ; side: LEFT { $$ = $1; } | RIGHT { $$ = $1; } ; playmode: BEFORE_KICK_OFF { $$ = $1; } | TIME_OVER { $$ = $1; } | PLAY_ON { $$ = $1; } ; It only gives warnings, but no compilation errors and creates the executable: rcss_parser.y: warning: 1 nonterminal useless in grammar [-Wother] rcss_parser.y: warning: 3 rules useless in grammar [-Wother] rcss_parser.y:284.25-32: warning: nonterminal useless in grammar: playmode [-Wother] %type < Playmode > playmode ^^^^^^^^ rcss_parser.y:333.17-44: warning: rule useless in grammar [-Wother] playmode: BEFORE_KICK_OFF { $$ = $1; } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rcss_parser.y:334.25-60: warning: rule useless in grammar [-Wother] | TIME_OVER { $$ = $1; } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rcss_parser.y:335.25-52: warning: rule useless in grammar [-Wother] | PLAY_ON { $$ = $1; } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ On Thu, Dec 19, 2013 at 12:15 PM, Gilberto Monroy <gilbertomonr...@gmail.com > wrote: > Akim: > 1 Yeah, you are right, I removed the .h and .hh files from the compilation > line, but the result is the same. > 2 Actually, the .hh file is included in rcss_driver.h, wich is included in > rcss_parser.y. John is right, there are inclusion guardas in the .hh file, > that is not the problem. I changed the code a bit in a way I do not > (directly or indirectly) include the .hh file in the .y file, but the > result is similar: > > g++ -o parser rcss_parser.tab.cc lex.yy.c rcss_parser_driver.cpp -lfl > In file included from rcss_parser.tab.cc:53:0: > > rcss_parser.tab.hh:583:3: error: > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ cannot be overloaded > rcss_parser.tab.hh:579:3: error: with > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ > rcss_parser.tab.hh:1896:3: error: redefinition of > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ > rcss_parser.tab.hh:1882:3: error: > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ previously declared here > In file included from rcss_lexer.l:28:0: > rcss_parser.tab.hh:583:3: error: > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ cannot be overloaded > rcss_parser.tab.hh:579:3: error: with > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ > rcss_parser.tab.hh:1896:3: error: redefinition of > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ > rcss_parser.tab.hh:1882:3: error: > ‘yy::RcssParser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, > Playmode, const location_type&)’ previously declared here > make: *** [parser] Error 1 > > > > > > On Thu, Dec 19, 2013 at 10:07 AM, John Horigan <j...@glyphic.com> wrote: > >> But the generated header has inclusion guards. He should be able to >> include it multiple times, even if it is a bad idea. There must be another >> problem. >> >> -- john >> >> >> On Thu, Dec 19, 2013 at 3:09 AM, Akim Demaille <a...@lrde.epita.fr>wrote: >> >>> >>> Le 19 déc. 2013 à 03:15, Gilberto Monroy <gilbertomonr...@gmail.com> a >>> écrit : >>> >>> > Hi everybody. >>> > >>> > My name is Gilberto, I use the next tools: >>> >>> Hi Gilberto, >>> >>> > g++ -o parser location.hh position.hh rcss_parser.tab.cc lex.yy.c >>> rcss_parser_driver.cpp -lfl >>> >>> This compilation line is fishy. You are not expected to compile >>> the headers (*.hh files). Compile only *.cc and *.ccp files. >>> >>> > from rcss_parser.y:15: >>> > rcss_parser.tab.hh:583:3: error: >>> >>> If I read this correctly, in your *.y file you #include the generated >>> parser header. Don't do that, Bison does for you. This would explain >>> why the symbols are defined twice. >>> >>> >>> >> >