I want to define a struct in a flex program :
%{
#include <math.h>
#include <string>
#include <vector>
#include <iostream>
#include <map>
struct Node{
string action;
vector<Node> vecini[];
};
%}
and even though I include vector and string I still get this errors:
error: ‘string’ does not name a type
error: field ‘vecini’ has incomplete type
Thank you !
Both vector and string are in the
stdnamespace so you should add it to the declaration of member variables of those types. Change the code to: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[];