error LNK1104: cannot open file vtkRendering.lib 解决方法

July 26, 2016

在《VTK 图形图像开发进阶》中,第一个程序 Chap01 按照书上编译会出现 1104 的错误,解决方法如下:

CMakeLists.txt

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT( Chap01 )

FIND_PACKAGE( VTK REQUIRED )
INCLUDE( ${VTK_USE_FILE} )

ADD_EXECUTABLE( 1.3_TestVTKInstall 1.3_TestVTKInstall.cpp)
TARGET_LINK_LIBRARIES( 1.3_TestVTKInstall vtkRendering vtkCommon )

最后一行改为:

TARGET_LINK_LIBRARIES( 1.3_TestVTKInstall ${VTK_LIBRARIES} )

然后重新用 Cmake 编译,按照书上步骤运行。


Profile picture

Written by Armin Li , a venture capitalist. [Weibo] [Subscribe]