2016-05-19 71 views
0

我從源代碼VTK 6.3安裝,我嘗試使用下面的cmake編譯我的項目:不能鏈接到VTK 6.3的/ usr /斌/勞工處:找不到-lvtkCommon

cmake_minimum_required (VERSION 2.6 FATAL_ERROR) 

project  (paintsquad) 
find_package (Qt5 REQUIRED COMPONENTS Widgets Core) 
find_package (VTK 6.3 REQUIRED) 
find_package (PCL 1.8.0 REQUIRED) 

include_directories (/usr/local/lib) 
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}) 
include_directories (${PCL_INCLUDE_DIRS}) 
link_directories (${PCL_LIBRARY_DIRS}) 
add_definitions  (${PCL_DEFINITIONS}) 

... 

QT5_WRAP_CPP (project_HEADERS_MOC ${project_HEADERS}) 
QT5_WRAP_UI (project_FORMS_HEADERS ${project_FORMS}) 

ADD_DEFINITIONS (${QT_DEFINITIONS}) 

ADD_EXECUTABLE (pcl_visualizer ${project_SOURCES} 
           ${project_FORMS_HEADERS} 
           ${project_HEADERS_MOC} 
           ${project_hpp_files}) 

TARGET_LINK_LIBRARIES (pcl_visualizer ${PCL_LIBRARIES}) 
qt5_use_modules (pcl_visualizer Widgets) 

但我發現了這些連接器錯誤:

/usr/bin/ld: cannot find -lvtkCommon 
/usr/bin/ld: cannot find -lvtkFiltering 
/usr/bin/ld: cannot find -lvtkImaging 
/usr/bin/ld: cannot find -lvtkGraphics 
/usr/bin/ld: cannot find -lvtkGenericFiltering 
/usr/bin/ld: cannot find -lvtkIO 
/usr/bin/ld: cannot find -lvtkRendering 
/usr/bin/ld: cannot find -lvtkVolumeRendering 
/usr/bin/ld: cannot find -lvtkHybrid 
/usr/bin/ld: cannot find -lvtkWidgets 
/usr/bin/ld: cannot find -lvtkInfovis 
/usr/bin/ld: cannot find -lvtkGeovis 
/usr/bin/ld: cannot find -lvtkViews 
/usr/bin/ld: cannot find -lvtkCharts 
collect2: error: ld returned 1 exit status 

我以前安裝過vtk 5.8,所以現在我不得不安裝了。 我使用的是Ubuntu 16.

+0

我相信這些庫與vtk-6不同。 – drescherjm

+0

我檢查過,所有的vtk 6.3 .so文件都在/ usr/local/lib – Pendar

+0

我想我可能不得不在最後使用vtk 5.8並用qt4編譯它。由於我用vtk 5.8編譯了pcl:/ – Pendar

回答

1

問題是我之前編譯過ptv vtk版本5.8,並且試圖使用vtk版本6.3,我之後安裝了它。

所以我解決了這個問題,首先刪除我的vtk 5.8,然後用vtk 6.3重新編譯pcl。

相關問題