I am trying to run graphviz as a library from CLion on Windows. It took me quite a while to get this far, and I hope this is the last hurdle. When I run the program, I see the following warning and graph
Warning: Could not load "C:\Program Files (x86)\Graphviz2.38\bin\gvplugin_pango.dll" - can't open the module
I am running CLion with MinGW 3.22 as a toolchain. CmakeLists and main.c are given below. Unfortunately, I can not register for graphviz forums, so I hope someone here can have suggestions. While I tried -
- Install and use mingw-64
- Installing the old version of GraphViz (2.28, current 2.38)
- Including gvplugin_pango library in cmakelists.txt
- Changing permissions for the Graphviz folder to provide full access to all, proven dot -c and works fine
- Set the env variable GVBINDIR to explicitly indicate installation 2.38.
- Tried setting up m32 in Cmakelists.txt (not 100% I did it right)
CMakeLists.txt
cmake_minimum_required(VERSION 3.6) project(Learning) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") set(GRAPHVIZ_INCLUDE_DIR "C:/Program Files (x86)/Graphviz2.38/include/graphviz") set(GRAPHVIZ_LIB_DIR "C:/Program Files (x86)/Graphviz2.38/lib/release/lib") set(SOURCE_FILES main.c) include_directories("${GRAPHVIZ_INCLUDE_DIR}") add_executable(Learning ${SOURCE_FILES}) find_library(CGRAPH_LIBRARY cgraph HINTS "${GRAPHVIZ_LIB_DIR}" REQUIRED) find_library(GVC_LIBRARY gvc HINTS "${GRAPHVIZ_LIB_DIR}" REQUIRED) target_link_libraries( Learning ${CGRAPH_LIBRARY} ${GVC_LIBRARY} )
main.c
#include <stdio.h> #include <malloc.h> #include <string.h> #include <gvc.h> #include <cgraph.h> int main() { Agraph_t *graph; Agnode_t *nodeA, *nodeB; Agedge_t *edge1; Agsym_t *symbol1; GVC_t *gvc; gvc = gvContext(); graph = agopen( "graph", Agdirected, NULL); nodeA = agnode(graph, "nodeA", 1); nodeB = agnode(graph, "nodeB", 1); edge1 = agedge(graph, nodeA, nodeB, 0, 1); printf("debug"); agsafeset(nodeA, "color", "red", ""); gvLayout(gvc, graph, "dot"); gvRender(gvc, graph, "dot", NULL); agclose(graph); return ( gvFreeContext(gvc)); }
graphviz mingw clion pango
SMC
source share