|
From: | Hans Aberg |
Subject: | Re: %union with STL |
Date: | Sun, 24 May 2009 18:36:28 +0200 |
On 22 May 2009, at 20:11, Paritosh Aggarwal wrote:
/*JIT PARSER BISON FILE*/ %{ #include<map> #include "heading.h" using namespace std; int yyerror(char *s); int yylex(void); %} %union { pair<const string,int>* it; int val; } ................compiling this gives the following error: jitparser.y:15: error: ISO C++forbids declaration of ‘pair’ with no type jitparser.y:15: error: expected ‘;’ before ‘<’ token
In the above, make sure the header for std::pair is included - impossible to see from your example. Perhaps the class used as a pointer needs to be instantiated before - try it without the 'union'. Sometimes "using namespace std" may cause problems - try without it. And you do not mention which Bison version you are using - in case it is a know bug fixed. Just some inputs.
Hans
[Prev in Thread] | Current Thread | [Next in Thread] |