Copying directly from the pdf is inconvenient.
demo.c:13:5: error: too few arguments to function ‘agopen’
g = agopen(“g”, Agdirected);
There are two parameters for agopen in the pdf, but it needs to be supplemented to three parameters.
Directly using the makefile causes issues:
simple: simple.o
dot: dot.o
demo: demo.o
undefined reference to `gvContext’
My fix:
simple: simple.o
$(CC) simple.o $(LDFLAGS) $(CFLAGS) -o simple
dot: dot.o
$(CC) dot.o $(LDFLAGS) $(CFLAGS) -o dot
demo: demo.o
$(CC) demo.o $(LDFLAGS) $(CFLAGS) -o demo
Later, I found Library Usage | Graphviz , but the link Files · main · graphviz / graphviz · GitLab does not lead to an actual file.