1

im have a flex-bison project working on ubuntu linux vmPlayer. Problem is, I'm trying to use map of string and int in my bison file for int-string casting, and it gives me error in file extra.y:

   %{   
   #include <stdio.h> 
   #include <stdlib.h>  
   #include <string.h>
   #include <map>
   using namespace std; 
   int yylex();   
   void yyerror(const char*);
   map<string,int> vars;   //ERROR

Error it give me:

 extra.y:9:12: error: ‘string’ was not declared in this scope
    map<string,int> vars;

..HELP ??

splash
  • 13,037
  • 1
  • 44
  • 67
mooly
  • 113
  • 1
  • 8
  • `#include ` (which is *not* even similar to `#include `) – rici Dec 04 '16 at 21:13
  • it still doesn't work, but why is it not similar to it? what is the difference ? – mooly Dec 05 '16 at 08:26
  • 2
    C++ strings and C strings are completely different. `#include ` gets you functions for C-style strings, which are not at all the same thing as the C++ data type `string`. For C++ `string`, use `#include `. – Thomas Padron-McCarthy Dec 05 '16 at 17:19

0 Answers0