我試圖在Windows中運行graphviz作爲CLion庫。我花了相當長的一段時間才弄到這麼遠,我希望這是最後的障礙。當我運行程序我看到下面的警告並沒有圖形Graphviz - 無法加載gvplugin_pango.dll
Warning: Could not load "C:\Program Files (x86)\Graphviz2.38\bin\gvplugin_pango.dll" - can't open the module
我正在與克利翁MinGW的3.22爲工具鏈。下面是CmakeLists和main.c。不幸的是,我無法註冊graphviz論壇,所以我希望這裏有人可能會有一些建議。到目前爲止,我已經試過 -
- 安裝和使用的MinGW-64
- 安裝的GraphViz的舊版本(2.28,目前爲2.38)
- 包括的CMakeLists.txt
- 的gvplugin_pango庫更改爲Graphviz的文件夾的權限,允許全面進入每個人,測試點-c和工作正常
- 設置GVBINDIR環境變量來明確指向2.38安裝 中的CMakeLists.txt(不是100%
- 嘗試設置M32我的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));
}
我無法在mingw安裝管理器中找到一個pango庫,是否有其他地方我應該看? – SMC