title: Bison & flex linkage - yylval type
body: <p>I have a school project, building a compiler. There is a header file given by the course staff, "proj.h" including a struct "Node", which should be used to build the parsing tree, and a set of functions.
  (That header does not include a <code>#define</code> for <code>YYSTYPE</code> to the Node type, and shouldn't be changed).
  I would like to use <code>Node*</code> in my .lex file, such as:</p>
  
  <pre><code>yylval = makeNode(...);
  </code></pre>
  
  <p>definition of makeNode:</p>
  
  <pre><code>Node *makeNode(const char* type,const char* value, Node *child);
  </code></pre>
  
  <p>I have tried defining the YYSTYPE both in .lex file and .ypp.</p>
  
  <p>.lex:</p>
  
  <pre><code>#include "proj.h"
  #include "parser.tab.hpp"
  #define YYSTYPE Node*
  </code></pre>
  
  <p>.ypp:</p>
  
  <pre><code>#include "proj.h"
  #define YYSTYPE Node*
  </code></pre>
  
  <p>I'm compiling using g++.
  It seems that the lval doesn't get the actual defintion as Node* as it should. There is a compilation error when trying to assign lval:</p>
  
  <pre><code>Invalid conversion from 'Node* {aka n*}' to 'YYSTYPE {aka int}'
  </code></pre>
  
  <p>Any help appreciated.</p>