I’m working on a program that will allow you to display a graph of nodes, and then visually update as the nodes themselves are updated. I am new to Visual Studio 2010 and follow the GraphViz tutorial at the address on the GraphViz website to get GraphViz working as a library. I have the following code, which is taken directly from the pdf file above.
#include <graphviz\gvc.h>
#include <graphviz\cdt.h>
#include <graphviz\graph.h>
#include <graphviz\pathplan.h>
using namespace std;
int main(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", AGDIGRAPH);
n = agnode(g, "n");
m = agnode(g, "m");
e = agedge(g, n, m);
agsafeset(n, "color", "red", "");
gvLayoutJobs(gvc, g);
gvRenderJobs(gvc, g);
gvFreeLayout(gvc, g);
agclose(g);
return (gvFreeContext(gvc));
}
After compilation, I get the following errors, which indicate that I do not have the correct link.
1> main.obj: error LNK2019: unresolved external symbol _gvFreeContext referenced in function _main
1> main.obj: error LNK2019: unresolved external symbol _agclose referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _gvFreeLayout referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _gvRenderJobs referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _gvLayoutJobs referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _agsafeset referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _agedge referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _agnode referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _agopen referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _gvParseArgs referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _gvContext referenced in function _main
V++
C:\Program Files (x86)\Graphviz2.26.3\include Include
C:\Program Files (x86)\Graphviz2.26.3\lib\release\lib
. .