Basic project build in VTK 6.2 has linker problems
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
My example project failed to compile, error-ing out at linker stage. I was trying to follow the documentation here: http://www.vtk.org/Wiki/VTK/Build_System_Migration
My CMakeLists.txt (well, the relevant bits): ################### find_package(VTK 6.2 EXACT REQUIRED NO_MODULE) include(${VTK_USE_FILE}) find_package(GLEW REQUIRED) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS}) include_directories( ${VTK_INCLUDE_DIRS} ${GLEW_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
####################
Make my_target
####################
set(EXE my_target) set(SOURCES my_target.cpp ) add_executable(${EXE} ${SOURCES}) target_link_libraries(${EXE} ${VTK_LIBRARIES} ${GLEW_LIBRARY} )
###################
The linker errors generated:
/usr/bin/ld: cannot find -lvtkWrappingTools /usr/bin/ld: cannot find -lvtkGUISupportQt /usr/bin/ld: cannot find -lvtkWrappingPythonCore /usr/bin/ld: cannot find -lvtkFiltersPython /usr/bin/ld: cannot find -lvtkGUISupportQtSQL /usr/bin/ld: cannot find -lvtkRenderingQt /usr/bin/ld: cannot find -lvtkglew /usr/bin/ld: cannot find -lvtkGUISupportQtOpenGL /usr/bin/ld: cannot find -lvtkLocalExample /usr/bin/ld: cannot find -lvtkViewsQt /usr/bin/ld: cannot find -lvtkoggtheora /usr/bin/ld: cannot find -lvtkGUISupportQtWebkit
My guess as to what's going on: The default set of libraries is a bit over-zealous, and includes things that never got built. For example, I built the VTK 6.2 nightly with no python or Qt wrapping, so was surprised to see the linker looking for that sort of thing.
One current work-around is to override the default by specifying exact stuff (modules/groups/libraries?).
Hope that's useful! Please let me know if more details would help.