在Ubuntu系统下,关于LAS文件转换成pcd文件,出现未定义函数的问题

在阅读《PCL从入门到精通》这本书时,在第三章的las文件转换成pcd文件中。遇到下列问题,(所用系统为Ubuntu18.04):

在执行make时出现如下的错误

pcl@pcl-ROS:~/pclLearn/las2pcd$ make
[ 50%] Linking CXX executable bin/las2pcd
CMakeFiles/las2pcd.dir/las2pcd.cpp.o: In function `main':
las2pcd.cpp:(.text+0x84): undefined reference to `liblas::ReaderFactory::CreateWithStream(std::istream&)'
las2pcd.cpp:(.text+0x93): undefined reference to `liblas::Reader::GetHeader() const'
las2pcd.cpp:(.text+0x9b): undefined reference to `liblas::Header::GetPointRecordsCount() const'
las2pcd.cpp:(.text+0x111): undefined reference to `liblas::Reader::ReadNextPoint()'
las2pcd.cpp:(.text+0x128): undefined reference to `liblas::Reader::GetPoint() const'
las2pcd.cpp:(.text+0x130): undefined reference to `liblas::Point::GetX() const'
las2pcd.cpp:(.text+0x171): undefined reference to `liblas::Reader::GetPoint() const'
las2pcd.cpp:(.text+0x179): undefined reference to `liblas::Point::GetY() const'
las2pcd.cpp:(.text+0x1bb): undefined reference to `liblas::Reader::GetPoint() const'
las2pcd.cpp:(.text+0x1c3): undefined reference to `liblas::Point::GetZ() const'
las2pcd.cpp:(.text+0x205): undefined reference to `liblas::Reader::GetPoint() const'
las2pcd.cpp:(.text+0x21a): undefined reference to `liblas::Point::GetColor() const'
las2pcd.cpp:(.text+0x23f): undefined reference to `liblas::Reader::GetPoint() const'
las2pcd.cpp:(.text+0x254): undefined reference to `liblas::Point::GetColor() const'
las2pcd.cpp:(.text+0x279): undefined reference to `liblas::Reader::GetPoint() const'
las2pcd.cpp:(.text+0x28e): undefined reference to `liblas::Point::GetColor() const'
las2pcd.cpp:(.text+0x41c): undefined reference to `liblas::Reader::~Reader()'
las2pcd.cpp:(.text+0x49f): undefined reference to `liblas::Reader::~Reader()'
出现libLAS中的相关函数未定义。如果大家用的是随书代码中提供的libLAS的库,应该均会出现此问题。

这是因为随书源码是针对的Windows系统的,提供的库为Windows系统下的静态库和动态库。不适用在Ubuntu系统下。

解决方法:

我们需要自己下载libLAS库的源码进行编译:

1.下载源码:http://download.osgeo.org/liblas/libLAS-1.8.1.tar.bz2,我这里下载的是1.8.1版本的

2. 编译源码:cd libLAS-1.8.1

                        mkdir build

                        cd build

                        cmake ..

                        make

3.将~/libLAS-1.8.1/build/bin/Release目录下的*.so文件复制到las2pcd的源码中。编译运行即可。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值