unresolved external symbol for Graphviz plugin library
Steps to reproduce
I'm using MSVC v142 and install Graphviz Windows library from this page https://www2.graphviz.org/Packages/stable/windows/10/cmake/Release/x64/ , then copy all of the include
and lib
directory to my project and add it to my CMakeLists.txt.
cmake_minimum_required (VERSION 3.8)
project ("VisibleSurfaceRendering")
set(EXECUTABLE_NAME "VisibleSurfaceRendering")
set(FILE_SOURCES
"${CMAKE_SOURCE_DIR}/Lib/imgui-sfml/imgui-SFML.cpp" # Workaround for ImGui-SFML
"Source/Main.cpp"
# another stuff here
)
set(GRAPHVIZ_LIB
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/gvc.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/cgraph.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/cdt.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/Pathplan.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/xdot.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/gvplugin_core.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/gvplugin_gdiplus.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/gvplugin_neato_layout.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/gvplugin_dot_layout.lib"
"${CMAKE_SOURCE_DIR}/Lib/graphviz/lib/gvplugin_pango.lib")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_executable(${EXECUTABLE_NAME}
${FILE_SOURCES})
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC _DEBUG_BUILD)
else()
add_executable(${EXECUTABLE_NAME}
WIN32
${FILE_SOURCES})
endif()
target_link_libraries(${EXECUTABLE_NAME} PUBLIC
${GRAPHVIZ_LIB}
# another stuff here
)
target_include_directories(${EXECUTABLE_NAME} PUBLIC
# another stuff here
"${CMAKE_SOURCE_DIR}/Lib/graphviz/include"
# another stuff here
)
// ...
extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
// ...
Full project is here https://github.com/andraantariksa/cit310-visible-surface-rendering/blob/285bd91ccdae4b544cbef6df028f3f73789b4c31/
Expected Behaviour
I'm expecting no error on compilation process
Actual Behaviour
Linking error
Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "struct gvplugin_library_t gvplugin_dot_layout_LTX_library" (?gvplugin_dot_layout_LTX_library@@3Ugvplugin_library_t@@A) C:\Users\andra\Projects\cit310-visible-surface-rendering\out\build\x64-Debug (default)\cit310-visible-surface-rendering C:\Users\andra\Projects\cit310-visible-surface-rendering\out\build\x64-Debug (default)\PainterRenderSystem.cpp.obj 1
OS Version
Windows 10 20H2 x64
Graphviz Version
Grapgviz 2.44.1