C Graphviz作为库错误:函数的参数太多‘;agnode’;

C Graphviz作为库错误:函数的参数太多‘;agnode’;,c,compiler-errors,graphviz,C,Compiler Errors,Graphviz,我试图运行中“使用Graphviz作为库”的一个示例 有人能帮我理解发生了什么事吗?为什么编译器会抱怨这些函数中的参数 谢谢 我将您的代码保存为g.c,然后发出此命令行 gcc -Wall `pkg-config libgvc --cflags --libs` g.c -o EXE -lgvc 这就产生了 g.c: In function ‘main’: g.c:14:5: error: too few arguments to function ‘agopen’ /usr/local/inc

我试图运行中“使用Graphviz作为库”的一个示例

有人能帮我理解发生了什么事吗?为什么编译器会抱怨这些函数中的参数


谢谢

我将您的代码保存为g.c,然后发出此命令行

gcc -Wall `pkg-config libgvc --cflags --libs` g.c -o EXE -lgvc
这就产生了

g.c: In function ‘main’:
g.c:14:5: error: too few arguments to function ‘agopen’
/usr/local/include/graphviz/cgraph.h:266:18: note: declared here
g.c:7:14: warning: unused variable ‘a’ [-Wunused-variable]
g.c:6:15: warning: variable ‘e’ set but not used [-Wunused-but-set-variable]
然后我添加了miss参数

g = agopen("g", Agdirected, 0);
还有图书馆小姐

gcc -Wall `pkg-config libgvc --cflags --libs` g.c -lgvc -lcgraph
现在,代码只需编译和链接两个警告:

g.c: In function ‘main’:
g.c:7:14: warning: unused variable ‘a’ [-Wunused-variable]
g.c:6:15: warning: variable ‘e’ set but not used [-Wunused-but-set-variable]
我认为这是可行的,因为我从源代码构建了graphviz,然后pkg配置是最新的。。。 程序仍然需要一些调试,运行它我得到:

./a.out

There is no layout engine support for "a.out"
Use one of: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
Error: Layout was not done.  Missing layout plugins? 

该消息是因为默认情况下,布局引擎使用exe名称(即a.out,默认的gcc编译和链接)作为布局字符串…

什么是
Agdirected
?它应该是一根绳子吗?否则你需要申报。而且,所有的错误信息都很清楚,大多数都是因为有些函数有很多参数。我照你说的做了,但是我仍然得到同样的错误!我使用的是基于debian 7的系统,我从默认的repo安装了libgraphviz。我想这是因为pkg配置信息可能很旧。编译时尝试添加-DWITH_CGRAPH.-DWITH_CGRAPH解决了我的问题,非常感谢!
g.c: In function ‘main’:
g.c:7:14: warning: unused variable ‘a’ [-Wunused-variable]
g.c:6:15: warning: variable ‘e’ set but not used [-Wunused-but-set-variable]
./a.out

There is no layout engine support for "a.out"
Use one of: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
Error: Layout was not done.  Missing layout plugins?