Am working on a program that will allow a graph of nodes to be displayed and then updated visually as the nodes themselves are updated. I am fairly new to Visual Studio 2010 and am following the GraphViz guide located at http://www.graphviz.org/pdf/libguide.pdf in order to get GraphViz working as a library. I have the following code which is taken straight from the pdf linked 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;
/* set up a graphviz context */
gvc = gvContext();
/* parse command line args - minimally argv[0] sets layout engine */
gvParseArgs(gvc, argc, argv);
/* Create a simple digraph */
g = agopen("g", AGDIGRAPH);
n = agnode(g, "n");
m = agnode(g, "m");
e = agedge(g, n, m);
/* Set an attribute - in this case one that affects the visible rendering */
agsafeset(n, "color", "red", "");
/* Compute a layout using layout engine from command line args */
gvLayoutJobs(gvc, g);
/* Write the graph according to -T and -o options */
gvRenderJobs(gvc, g);
/* Free layout data */
gvFreeLayout(gvc, g);
/* Free graph structures */
agclose(g);
/* close output file, free context, and return number of errors */
return (gvFreeContext(gvc));
}
After compiling I get the following errors which indicate that I do not have it correctly linked.
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
Within the VC++ Directories I have
C:\Program Files (x86)\Graphviz2.26.3\include in the Include Directories
and
C:\Program Files (x86)\Graphviz2.26.3\lib\release\lib in the Library Directories
Any help would be greatly appreciated to help get this working. Thank you.