Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 使用pcl库生成错误_C++_Cmake - Fatal编程技术网

C++ 使用pcl库生成错误

C++ 使用pcl库生成错误,c++,cmake,C++,Cmake,当我学习本教程时,我偶然发现了一个错误 我在这个网站上安装了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

当我学习本教程时,我偶然发现了一个错误
我在这个网站上安装了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\u根目录


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

我刚刚经历了许多相同问题的困扰。对我来说,这是因为CMake尝试使用32位编译器,然后查找32位依赖项,但PCL安装了64位库

我可以通过在我的CMakeList.txt文件中设置
set(Boost\u DEBUG ON)
找到这个问题。这就揭示了Boost正在使用的路径,其中包含“x86”

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


也许这对你有帮助

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

错误是
找不到Boost
。使用
Boost\u ROOT
变量指向您的Boost安装。