在遵循本教程的同时,我偶然发现了错误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})
答案 0 :(得分:0)
要删除第一个警告:- 设置环境变量:PCL 1.8.1_ROOT
添加路径:%PCL 1.8.1_ROOT
在Cmake菜单上,尝试“文件->删除缓存”。
答案 1 :(得分:0)
我遇到了很多同样的问题。对我来说,这是CMake尝试使用 32bit 编译器,然后寻找32bit依赖性的结果,但是PCL装有 64bit 库。
我可以通过在CMakeList.txt文件中设置set(Boost_DEBUG ON)
来解决这个问题。然后,这揭示了Boost正在使用的路径,并且这些路径中包含“ x86”。
我通过使用CMake GUI(在项目所在的命令行中运行cmake-gui .
)然后选择Visual Studio 2015 Win64
作为Generator来解决了这个问题。然后,生成了一个Visual Studio项目,并使用了64位编译器,这意味着它将查找“ x64” Boost目录。
也许对您有帮助。
答案 2 :(得分:0)
我在PCL-1.9.1和VS2015上遇到了同样的问题;我通过将vs2015升级到vs2019来解决了这个问题