Qt Creator cannot resolve gvContext on Ubuntu

梦想的初衷 提交于 2019-12-24 23:09:10

问题


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!

来源:https://stackoverflow.com/questions/50321412/qt-creator-cannot-resolve-gvcontext-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!