系统:cuda 11.3、gcc 7.5、boost 1.65.1、pcl 1.8.0
当我编译使用PCL库的代码时,它显示以下错误
/usr/include/pcl-1.8/pcl/io/file_io.h(264): error: namespace "boost" has no member "numeric_cast"
/usr/include/pcl-1.8/pcl/io/file_io.h(264): error: type name is not allowed
/usr/include/pcl-1.8/pcl/io/file_io.h(280): error: namespace "boost" has no member "numeric_cast"
/usr/include/pcl-1.8/pcl/io/file_io.h(280): error: type name is not allowed
/usr/include/pcl-1.8/pcl/io/file_io.h(346): error: namespace "boost" has no member "iequals"
/usr/include/pcl-1.8/pcl/io/file_io.h(372): error: namespace "boost" has no member "iequals"
/usr/include/pcl-1.8/pcl/io/pcd_io.h(485): error: name followed by "::" must be a class or namespace name
/usr/include/pcl-1.8/pcl/io/pcd_io.h(493): error: name followed by "::" must be a class or namespace name
我查看了
file_io.h
,发现相关代码是<pcl/io/boost.h>
。在这个文件中,标头<boost/numeric/conversion/cast.hpp>
包含numeria_cast函数,显然不包含这个标头。这个错误与宏__CUDACC__
有关吗?我该如何解决这个问题? /usr/include/pcl-1.8/pcl/io/boost.h
是:
#ifndef _PCL_IO_BOOST_H_
#define _PCL_IO_BOOST_H_
#if defined __GNUC__
# pragma GCC system_header
#endif
#ifndef __CUDACC__
//https://bugreports.qt-project.org/browse/QTBUG-22829
#ifndef Q_MOC_RUN
#include <boost/version.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread.hpp>
#include <boost/thread/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/bind.hpp>
#include <boost/cstdint.hpp>
#include <boost/function.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/algorithm/string.hpp>
#ifndef Q_MOC_RUN
#include <boost/date_time/posix_time/posix_time.hpp>
#endif
#if BOOST_VERSION >= 104700
#include <boost/chrono.hpp>
#endif
#include <boost/tokenizer.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_array.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#if BOOST_VERSION >= 104900
#include <boost/interprocess/permissions.hpp>
#endif
#include <boost/iostreams/device/mapped_file.hpp>
#define BOOST_PARAMETER_MAX_ARITY 7
#include <boost/signals2.hpp>
#include <boost/signals2/slot.hpp>
#endif
#endif
#endif // _PCL_IO_BOOST_H_
是的,我用普通的 gcc 编译器解决了这个问题...不要使用 NVCC!