title: How do I get rid of this duplicate declaration of YYSTYPE?
body: <p>Here is the relevant error: </p>
  
  <pre><code>grammar.y:72: error: conflicting declaration ‘typedef union YYSTYPE YYSTYPE’
  y.tab.h:83: error: ‘YYSTYPE’ has a previous declaration as ‘typedef union YYSTYPE YYSTYPE’
  make: *** [y.tab.o] Error 1
  </code></pre>
  
  <p>I am using flex and byacc together to produce a translator. My build has this structure: </p>
  
  <ol>
  <li>Make the y.tab.h from the grammar.y file. </li>
  <li>Include y.tab.h in the tokens.lex file, and compile that to produce lex.yy.c. </li>
  <li>Include lex.yy.c back in the grammar file. This way, we can see yylex. </li>
  </ol>
  
  <p>What seems to be happening is this: The y.tab.h contains a the union declaration of the YYSTYPE union. This gets included by lex.yy.c, which gets included by grammar.y. But at the same time, grammar.y is producing its own version of the union, and the two clash. </p>
  
  <p>Is this not the standard approach? Is there something I need to change to make it build correctly? </p>