Je tente d'exécuter graphviz en tant que bibliothèque à partir de CLion sous Windows. Il m'a fallu beaucoup de temps pour aller aussi loin et j'espère que c'est le dernier obstacle. Quand je lance le programme que je vois l'avertissement suivant et aucun graphiqueGraphviz - Impossible de charger gvplugin_pango.dll
Warning: Could not load "C:\Program Files (x86)\Graphviz2.38\bin\gvplugin_pango.dll" - can't open the module
Je suis en Clion avec MinGW 3.22 comme toolchain. CmakeLists et main.c sont ci-dessous. Malheureusement, je suis incapable de m'inscrire aux forums graphviz, j'espère que quelqu'un ici pourrait avoir des suggestions. Jusqu'à présent, je l'ai essayé -
- Installation et utilisation MinGW-64
- Installation d'une ancienne version de GraphViz (2.28, le courant est 2,38)
- Y compris la bibliothèque gvplugin_pango dans CMakeLists.txt
- Changer les autorisations pour le dossier Graphviz pour permettre un accès complet à tout le monde, testé -c point et fonctionne très bien
- Définissez la variable d'env GVBINDIR pour pointer explicitement à l'installation 2,38
- mise essayé M32 dans CMakeLists.txt (pas à 100% Je l'ai fait correctement)
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));
}
Je n'ai pas trouvé de bibliothèque pango dans le gestionnaire d'installation de MINGW, y a-t-il un autre endroit où je devrais regarder? – SMC