[vtkusers] Linker problem using VTK, CMake and Qt

Florian Thevißen F.Thevissen at apodius.de
Tue Jun 30 12:29:20 EDT 2015


Hi Nicole,

Thank you very much - that solved it! I guess I have to learn a bit 
about the inner workins of CMake. I would not have thought it possible 
for the problem to be this line.

Best regards,
Florian



Am 30.06.2015 um 15:28 schrieb Nicole Kovacs:

> Hi Florian,
>
>
> I'm not so experienced with VTK myself, but I've run into similar 
> errors. I may be wrong, but I believe the error you're getting is from 
> this line:
>
> |set (VTK_LIBRARIES vtkRendering vtkGraphics vtkHybrid QVTK)|
> I don't think you actually need this line. If you check the VTK Wiki 
> examples, most (if not all) of them have the following in the CMake file:
> |if(VTK_LIBRARIES) target_link_libraries(Cylinder ${VTK_LIBRARIES}) 
> else() target_link_libraries(Cylinder vtkHybrid vtkWidgets) endif() |
> Which makes me believe vtkRendering, vtkGraphics, and vtkHybrid are 
> not arranged in VTK6 as they were before.
>
> As to QVTK, I have found in this vtkusers' message 
> (http://public.kitware.com/pipermail/vtkusers/2013-May/079715.html) 
> that if you turn on VTK_Group_Qt when building VTK, you don't need to 
> put QVTK in the CMake file.
>
> I hope this was helpful. If it solved your issue, feel free to forward 
> this to the vtkusers list if you want.
> Nicole
>
> ------------------------------------------------------------------------
> *From:* vtkusers <vtkusers-bounces at vtk.org> on behalf of Florian 
> Thevißen <F.Thevissen at apodius.de>
> *Sent:* Tuesday, June 30, 2015 4:59 AM
> *To:* vtkusers at vtk.org
> *Subject:* [vtkusers] Linker problem using VTK, CMake and Qt
>
> 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/cfaa4e42/attachment.html>


More information about the vtkusers mailing list