我使用Ubuntu20.04后,git克隆“汉代-校准-ROS”catkin_make
给出错误。我增加了一些错误
/usr/local/include/ceres/autodiff_cost_function.h:211:69: required from ‘bool ceres::AutoDiffCostFunction<CostFunctor, kNumResiduals, Ns>::Evaluate(const double* const*, double*, double**) const [with CostFunctor = ReprojectionError3D; int kNumResiduals = 3; int ...Ns = {4, 3}]’
/usr/local/include/ceres/autodiff_cost_function.h:201:8: required from here
/usr/local/include/ceres/internal/autodiff.h:314:9: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 4, 3>’
314 | using Parameters = typename ParameterDims::Parameters;
| ^~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:347:47: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 4, 3>’
347 | Make1stOrderPerturbations<Parameters>::Apply(parameters,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
348 | parameters_as_jets.data());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:356:39: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 4, 3>’
356 | Take1stOrderParts<Parameters>::Apply(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
357 | num_outputs, residuals_as_jets.data(), jacobians);
/usr/include/pcl-1.10/pcl/visualization/pcl_visualizer.h:880:100: required from here
/usr/include/c++/9/bits/predefined_ops.h:283:11: error: no match for call to ‘(pcl::getFieldIndex(const string&, const std::vector<pcl::PCLPointField>&) [with PointT = pcl::PointXYZRGB; std::string = std::__cxx11::basic_string<char>]::<lambda(const int&)>) (const pcl::PCLPointField&)’
283 | { return bool(_M_pred(*__it)); }
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/pcl-1.10/pcl/visualization/impl/pcl_visualizer.hpp:82:72: required from ‘bool pcl::visualization::PCLVisualizer::addPointCloud(const typename pcl::PointCloud<PointT>::ConstPtr&, const string&, int) [with PointT = pcl::PointXYZ; typename pcl::PointCloud<PointT>::ConstPtr = boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZ> >; std::string = std::__cxx11::basic_string<char>]’
/usr/include/pcl-1.10/pcl/visualization/pcl_visualizer.h:867:68: required from here
/usr/include/c++/9/bits/predefined_ops.h:283:11: error: no match for call to ‘(pcl::getFieldIndex(const string&, const std::vector<pcl::PCLPointField>&) [with PointT = pcl::PointXYZ; std::string = std::__cxx11::basic_string<char>]::<lambda(const int&)>) (const pcl::PCLPointField&)’
283 | { return bool(_M_pred(*__it)); }
| ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/pcl-1.10/pcl/common/io.h:586,
from /usr/include/pcl-1.10/pcl/io/file_io.h:41,
from /usr/include/pcl-1.10/pcl/io/pcd_io.h:44,
from /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:70,
from /opt/ros/noetic/include/pcl_ros/point_cloud.h:9,
from /home/level/ACobot_Project/handeyecal_ws/src/Handeye-Calibration-ROS/src/camera_driver/src/realsense2_driver.cpp:27:
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:73:7: note: candidate: ‘pcl::getFieldIndex(const string&, const std::vector<pcl::PCLPointField>&) [with PointT = pcl::PointXYZ; std::string = std::__cxx11::basic_string<char>]::<lambda(const int&)>’
73 | [&field_name](const auto& field) { return field.name == field_name; });
| ^
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:73:7: note: no known conversion for argument 1 from ‘const pcl::PCLPointField’ to ‘const int&’
make[2]: *** [camera_driver/CMakeFiles/realsense2_driver.dir/build.make:76: camera_driver/CMakeFiles/realsense2_driver.dir/src/realsense2_driver.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2053: camera_driver/CMakeFiles/realsense2_driver.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
Invoking "make -j24 -l24" failed
那么你能告诉我如何解决这个问题吗?
发布于 2022-07-29 05:41:20
当我看错误时,有两行:
from /home/level/ACobot_Project/handeyecal_ws/src/Handeye-Calibration-ROS/src/camera_driver/src/realsense2_driver.cpp:27:
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:73:7: note: candidate: ‘pcl::getFieldIndex(const string&, const std::vector<pcl::PCLPointField>&) [with PointT = pcl::PointXYZ; std::string = std::__cxx11::basic_string<char>]::<lambda(const int&)>’
73 | [&field_name](const auto& field) { return field.name == field_name; });
和:
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:73:7: note:
no known conversion for argument 1 from ‘const pcl::PCLPointField’ to ‘const int&’
所以我看了一下包裹:https://github.com/lixiny/Handeye-Calibration-ROS/tree/master/src/camera_driver
首先,请注意,pcl库1.10使用c++ 14 (cf https://github.com/PointCloudLibrary/pcl/issues/1638)编译,但是CMakeLists.txt强制使用c++ 11或更低版本:
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
要解决这个问题,最好使用c++ 14进行编译,这通常出现在Ubuntu 20上:
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
if(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
endif()
我还可以看到,代码是为Ubuntu 18和ros旋律制作的。让这个第一次尝试,如果它不工作,请将整个错误代码。
干杯~
https://stackoverflow.com/questions/72944413
复制相似问题