I want to write an application in C++ that displays an automaton using graphviz. I tried out a sample taken from documentation but I get 'undefined reference gvContext', along with the other function calls. The sample code I tried is :
void create_automaton(int argc, char *argv[]){
Agraph_t *g;
Agnode_t *n, *m;
Agedge_t *e;
Agsym_t *a;
GVC_t *gvc;
gvc = gvContext();
gvParseArgs(gvc, argc, argv);
g = agopen("g", Agdirected, 0);
n = agnode(g, "n", 1);
m = agnode(g, "m", 1);
e = agedge(g, n, m, 0, 1);
agsafeset(n, "color", "red", "");
gvLayoutJobs(gvc, g);
gvRenderJobs(gvc, g);
gvFreeLayout(gvc, g);
agclose(g);
}
I included without which the variable types wouldn't have been recognized, but which doesn't make a difference for my issue. I thought about linking library to the project but this is obviously not the problem since the program detects the header. It is a beginner question, but I would really appreciate if someone has an idea about this. I couldn't find anything significant on the internet, all other similar problems I've found had the solution of installing graphviz-dev, which I already have.
Thank you in advance!