title: C code from gcc to Visual Studio Express 2010
body: <p>I'm trying to move some code I have written and compiled succesfully with gcc under Visual Studio Express 2010.</p>
  
  <p>I have the following header file.</p>
  
  <pre><code>#ifndef _SYMTAB_H_
  #define _SYMTAB_H_
  
  #define NHASH 997
  
  typedef enum {NOTYPE, INTTYPE, DOUBLETYPE, STRINGTYPE} SYMBOLTYPE;
  
  typedef union {
      int intvalue;
      double doublevalue;
      char *stringvalue;
  } SYMBOLVALUE;
  
  typedef struct {
      SYMBOLTYPE type;
      char *name;
      SYMBOLVALUE value;
  } SYMBOL;
  
  void initSymbolTable(void);
  SYMBOL *lookup(char *sym);
  SYMBOL *addIntSymbol(char *name, int value);
  SYMBOL *addDoubleSymbol(char *name, double value);
  SYMBOL *addStringSymbol(char *name, char *value);
  char *getSymbolName(SYMBOL *sym);
  int getIntSymbolValue(SYMBOL *sym);
  double getDoubleSymbolValue(SYMBOL *sym);
  char *getStringSymbolValue(SYMBOL *sym);
  void printSymbolTable(void);
  
  #endif
  </code></pre>
  
  <p>If I write a piece of code using that header file such as:</p>
  
  <pre><code>int main(int argc, char *argv[]) {
      initSymbolTable();
  
      printSymbolTable();
  
      SYMBOL *intSymbol = addIntSymbol("pippo", 10);
  
      printSymbolTable();
  
      printf("All tests successfull\n");
      return 0;
  }
  </code></pre>
  
  <p>I get the followin error:</p>
  
  <p>error C2275: 'SYMBOL': illegal use of this type as an expression</p>
  
  <p>which is descrideb here: <a href="http://msdn.microsoft.com/en-us/library/76c9k4ah(v=vs.71).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/76c9k4ah(v=vs.71).aspx</a></p>
  
  <p>Anyway I don'tunderstand what's wrong with that.
  I have also set the "Compile As" property to "Compile as C Code" in the prject properties under C/C++->Advanced. Moreover all files are saved as *.c and *.h.</p>