简体   繁体   中英

Cmake error by using pcl library

While I followed this tutorial, I stumbled upon error http://pointclouds.org/documentation/tutorials/cloud_viewer.php#cloud-viewer
I installed PCL-1.8.1rc1-AllInOne-msvc2017-win64.exe on this site https://github.com/PointCloudLibrary/pcl/releases/tag/pcl-1.8.1rc1
I made a folder which include "cloud_viewer.cpp" and "CMakeLists.txt" following above tutorial, and used CMake by adding path. But this error came out.

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)

and I don't know how i can fix it.

this is 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})

To remove the first Warning:- set the Environment Variables: PCL 1.8.1_ROOT

add path: %PCL 1.8.1_ROOT

On the Cmake menu, try "File-> Delete Cache".

I've just been through a lot of hoops with the same problem. For me it turns out this was a result of CMake trying to use the 32bit compiler and that then looked for 32bit dependencies, but PCL has the 64bit libraries installed with it.

I was able to hunt this down by setting set(Boost_DEBUG ON) in my CMakeList.txt file. This then revealed the paths that Boost was using and these had "x86" in them.

I got past this problem by using the CMake GUI to (run cmake-gui . in the command line where your project is) and then selecting Visual Studio 2015 Win64 as the Generator. This then generated a Visual Studio project and the 64bit compiler was used, meaning it then looked for the "x64" Boost directory.

Maybe that helps for you.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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