繁体   English   中英

使用pcl库的CMake错误

[英]Cmake error by using pcl library

在遵循本教程的过程中,我偶然发现了错误http://pointclouds.org/documentation/tutorials/cloud_viewer.php#cloud-viewer
我在此站点https://github.com/PointCloudLibrary/pcl/releases/tag/pcl-1.8.1rc1上安装了PCL-1.8.1rc1-AllInOne-msvc2017-win64.exe
我按照上面的教程制作了一个包含“ cloud_viewer.cpp”和“ CMakeLists.txt”的文件夹,并通过添加路径使用了CMake。 但是这个错误出来了。

CMake Warning (dev) at CMakeLists.txt:5 (find_package):
  Policy CMP0074 is not set: find_package uses PackageName_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable PCL_ROOT is set to:

    C:\Program Files\PCL 1.8.1 (or C:\Program Files (x86)\PCL 1.8.1)

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Found eigen: C:/PCL 1.6.0/3rdParty/Eigen/include  
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE  
Could NOT find Boost
CMake Error at C:/PCL 1.6.0/cmake/PCLConfig.cmake:39 (message):
  common is required but boost was not found
Call Stack (most recent call first):
  C:/PCL 1.6.0/cmake/PCLConfig.cmake:354 (pcl_report_not_found)
  C:/PCL 1.6.0/cmake/PCLConfig.cmake:500 (find_external_library)
  CMakeLists.txt:5 (find_package)

而且我不知道该如何解决。

这是CMakesLists.txt

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(cloud_viewer)

find_package(PCL 1.2 REQUIRED)

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_executable (cloud_viewer cloud_viewer.cpp)
target_link_libraries (cloud_viewer ${PCL_LIBRARIES})

删除第一个警告:-设置环境变量:PCL 1.8.1_ROOT

添加路径:%PCL 1.8.1_ROOT

在Cmake菜单上,尝试“文件->删除缓存”。

我经历了很多同样的问题。 对我来说,这是CMake尝试使用32位编译器,然后寻找32位依赖项的结果,但是PCL装有64位库。

我可以通过在CMakeList.txt文件中设置set(Boost_DEBUG ON)来解决这个问题。 然后,这揭示了Boost正在使用的路径,并且这些路径中包含“ x86”。

通过使用CMake GUI(在项目所在的命令行中运行cmake-gui . ),然后选择Visual Studio 2015 Win64作为Generator,我解决了这个问题。 然后,这生成了一个Visual Studio项目,并使用了64位编译器,这意味着它随后查找了“ x64” Boost目录。

也许对您有帮助。

我在PCL-1.9.1和VS2015上遇到了同样的问题;我通过将vs2015升级到vs2019来解决了这个问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM