[vtkusers] Linker problem using VTK, CMake and Qt

Florian Thevißen F.Thevissen at apodius.de
Tue Jun 30 04:59:01 EDT 2015


Hello everyone,

I’m trying to get a project to compile using Qt Creator, but I keep 
running into a linker error:

    LINK : fatal error LNK1104: file”vtkRendering.lib” can not be opened

Obviously, the linker can not find the library it needs. This is what I did:

1) Build VTK 64bit from scratch using cmake-gui and MSCV13. I built both 
ALL_BUILD and INSTALL with administrator privileges. This installed VTK 
into C:\Program Files\VTK . I also set the VTK_GROUP_QT and 
BUILD_SHARED_LIBS flags.

2) Set an environment variable VTK_DIR to C:\Program Files\VTK

3) Set the CMakefile

|cmake_minimum_required (VERSION 2.6 FATAL_ERROR) project 
(pcl-visualizer) find_package (Qt4 REQUIRED) find_package (VTK REQUIRED) 
find_package (PCL 1.7 REQUIRED) include_directories 
(${PCL_INCLUDE_DIRS}) link_directories (${PCL_LIBRARY_DIRS}) 
add_definitions (${PCL_DEFINITIONS}) set (project_SOURCES main.cpp 
pclviewer.cpp) set (project_HEADERS pclviewer.h) set (project_FORMS 
pclviewer.ui) set (VTK_LIBRARIES vtkRendering vtkGraphics vtkHybrid 
QVTK) QT4_WRAP_CPP (project_HEADERS_MOC ${project_HEADERS}) QT4_WRAP_UI 
(project_FORMS_HEADERS ${project_FORMS}) qt4_add_resources(RCC_GENERATED 
${RCC}) INCLUDE (${QT_USE_FILE}) ADD_DEFINITIONS (${QT_DEFINITIONS}) 
ADD_EXECUTABLE (pcl_visualizer ${project_SOURCES} 
${project_FORMS_HEADERS} ${project_HEADERS_MOC}) TARGET_LINK_LIBRARIES 
(pcl_visualizer ${QT_LIBRARIES} ${PCL_LIBRARIES} ${VTK_LIBRARIES}) |

4) Then I did a

    cmake . -G”NMake Makefiles”
    nmake

and after a compiling phase I’m told by nmake, that, as mentioned initially:

    LINK : fatal error LNK1104: file”vtkRendering.lib” can not be opened

Interestingly enough, the file does indeed not exist in the C:\Program 
Files\VTK\lib directory, though there are files named quite similiarly:

    vtkRenderingOpenGL-6.2.lib
    vtkRenderingQT-6.2.lib

for example. What am I doing wrong?

Thanks in advance!
Florian Thevißen

​


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150630/c537aa64/attachment.html>


More information about the vtkusers mailing list