Defining a struct in flex error C++

Both vector and string are in the std namespace so you should add it to the declaration of member variables of those types. Change the code to:

%{

#include <math.h>
#include <string>
#include <vector>
#include <iostream>
#include <map>

struct Node{
    std::string action;
    std::vector<Node*> vecini[];
};

%}

EDIT: (thanks to Kerrek SB): also you can not define a vector of Node as a member of Node. Instead use a vector of pointers to node like so: std::vector<Node*> vecini[];

Leave a Comment