I want to involve a Graphviz library gvc
in my Cpp project.
The Cpp project is an extremely simplified syntax analyser, and I include the graphviz/gvc.h
to draw syntax analysis tree.
I construct the project via CMake
and MinGW
tools.
Then I wrote my CMakeLists.txt
as below:
cmake_minimum_required(VERSION 3.10)
project(Analyser)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(GV_HOME "D:/Program Files (x86)/Graphviz")
file(GLOB SRC CONFIGURE_DEPENDS src/*.cpp)
include_directories(${GV_HOME}/include)
include_directories(include)
link_directories(${GV_HOME}/lib)
add_executable(${PROJECT_NAME} src/main/main.cpp ${SRC})
target_link_libraries(${PROJECT_NAME} gvc cgraph)
Then I successfully compiled the project and got an .exe file.
Well, the strange thing occured: It run without returning any results on the terminal.
I can’t figure out the reason…
And the project structure is like:
project---
|*--src
|
|*--build
|
|*--include
At first, I couldn’t compile the project.
Then I try to add an entry cgraph
in the target_link_libraries()
in CMakeLists.txt
and successfully compile it in the end, while can’t run the .exe normally.
I wanna konw how to address that question.
user24804670 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1