用PCL库构建c++文件时出错



我正在尝试创建我的第一个c++文件,但我在一些构建错误上绊倒。对于我当前的cpp文件,我使用外部库PCL。当构建我的CPP文件时,在终端中显示以下错误:

-- Eigen found (include: /usr/include/eigen3, version: 3.3.7)
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
-- OpenNI2 found (include: /usr/include/openni2, lib: /usr/lib/libOpenNI2.so)
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- The imported target "vtkParseOGLExt" references the file
"/usr/bin/vtkParseOGLExt-7.1"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkRenderingPythonTkWidgets" references the file
"/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtk" references the file
"/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
-- The imported target "pvtk" references the file
"/usr/bin/pvtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
** WARNING ** io features related to libusb-1.0 will be disabled
-- looking for PCL_COMMON
-- looking for PCL_OCTREE
-- looking for PCL_IO
CMake Error at ouster_client/CMakeLists.txt:57 (target_link_libraries):
IMPORTED library can only be used with the INTERFACE keyword of
target_link_libraries

-- PCL Libraries: pcl_common;pcl_octree;pcl_io;/usr/lib/x86_64-linux- 
gnu/libboost_system.so;/usr/lib/x86_64-linux- 
gnu/libboost_filesystem.so;/usr/lib/x86_64-linux- 
gnu/libboost_date_time.so;/usr/lib/x86_64-linux- 
gnu/libboost_iostreams.so;/usr/lib/x86_64-linux- 
gnu/libboost_regex.so;/usr/lib/libOpenNI.so;/usr/lib/libOpenNI2.so;vtkChartsCore; 
vtkCommonColor;vtkCommonCore;vtksys;vtkCommonDataModel;vtkCommonMath;vtkCommonMisc; 
vtkCommonSystem;vtkCommonTransforms;vtkCommonExecutionModel;vtkFiltersGeneral; 
vtkCommonComputationalGeometry;vtkFiltersCore;vtkInfovisCore;vtkFiltersExtraction; 
vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;
vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources; 
vtkRenderingFreeType;/usr/lib/x86_64-linux-gnu/libfreetype.so;
/usr/lib/x86_64-linux-gnu/libz.so;vtkFiltersModeling;vtkImagingSources; vtkInteractionStyle;vtkInteractionWidgets;vtkFiltersHybrid;vtkImagingColor;vtkImagingGeneral;vtkImagingHybrid;vtkIOImage;vtkDICOMParser;vtkmetaio;/usr/lib/x86_64-linux-gnu/libjpeg.so;/usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libtiff.so;vtkRenderingAnnotation; vtkRenderingVolume;vtkIOXML;vtkIOCore;vtkIOXMLParser;/usr/lib/x86_64-linux-gnu/libexpat.so;vtkIOGeometry;vtkIOLegacy;vtkIOPLY;vtkRenderingLOD;vtkViewsContext2D;vtkViewsCore;vtkRenderingContextOpenGL2;vtkRenderingOpenGL2
-- Configuring incomplete, errors occurred!
See also 
"~/build/CMakeFiles/CMakeOutput.log"
See also 
"~/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:290: cmake_check_build_system] Error 1
我没有任何经验来解决这个问题。我的CMakeList.txt包含以下内容:
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PCL_DIR "/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake")
set(PCL_INCLUDE_DIRS /usr/lib/x86_64-linux-gnu/cmake/pcl)
find_package( PCL 1.3 REQUIRED common io)
include_directories(  ${catkin_INCLUDE_DIRS}  ${PCL_INCLUDE_DIRS} )
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
#target_link_libraries(src/test.cpp ${PCL_LIBRARIES})
target_link_libraries( ${PCL_LIBRARIES})
add_executable(Test src/test.cpp)

如果你运行的是Ubuntu 20.04,那么vtk的命名就不同了,如果你查看/usr/bin内部,你会发现它被称为vtk7。如果导航到/usr/bin并运行sudo cp ./vtk7 ./vtk,则可以解决vtk对应的错误。

相关内容

  • 没有找到相关文章

最新更新