Undefined reference to `_imp__agread'

My last example doesn’t have an input file and using binary mode on output didn’t help. I’ve also tried generating text files in svg och dot format, but the segfault persists.

What about calling gvRenderFilename, does that work?

This might probably come from the file lib/gvc/gvc.def which contain:
LIBRARY “gvc”

I believe it should be:
LIBRARY “libgvc”

Same remark with lib/pathplan/pathplan.def

That is not the reason. MinGW produces libraries with the lib prefix, while Native Windows doesn’t.

So, there might be something I do not understand. While working on “label: area too large for rtree” with sfdp/neato/fdp I build Graphviz with CMake and Mingw and noticed this behaviour wrt naming dlls.

FYI, I have attached a patch at "label: area too large for rtree" with sfdp/neato/fdp . Was OK with version 2.38.0 (#2088) · Issues · graphviz / graphviz · GitLab. Do you have an opinion please ? Many thanks.

Yes, that worked. Thanks!

For reference, here is the working program:

#include <cgraph.h>
#include <gvc.h>
#include <stdio.h>
#include <stdlib.h>

void export_graph_string(){

    char source[] = "digraph { a -> b; b -> c; c -> d; d -> a; }";
    Agraph_t *g = agmemread(source);

    GVC_t *gvc = gvContext();
    gvLayout(gvc, g, "dot");

    gvRenderFilename(gvc, g, "png", "test.png");

    gvFreeLayout(gvc, g);
    agclose(g);
    gvFreeContext(gvc);
}

int main() {
  export_graph_string();
}

The renderd PNG:

test

1 Like