环境:ubuntu18.04 + pcl1.8
主要还是使用了pcl库中的一些简单的函数实现

src/pcd2ply.cpp:

//用于把点云由pcd文件转为ply文件
#include <iostream>
#include <pcl/io/pcd_io.h>  
#include <pcl/io/ply_io.h>

#include <pcl/point_types.h>  

using namespace std;
using namespace pcl;

string pcd_path = "/home/jy/Desktop/2011_09_30/2011_09_30_drive_0027_sync/velodyne_points/out_fliter_010.pcd";
string ply_path = "/home/jy/Desktop/2011_09_30/2011_09_30_drive_0027_sync/velodyne_points/out_fliter_010.ply";

int PCDtoPLYconvertor(string & input_filename ,string& output_filename)
{
    //此处的PointXYZI可以换成PointXYZ等其他格式的,看自己点云的格式来,只要整个程序统一即可
    pcl::PointCloud<pcl::PointXYZI>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZI>);
    if (pcl::io::loadPCDFile<pcl::PointXYZI>(input_filename, *cloud) == -1)
    {
        PCL_ERROR("Couldn't read pcd file \n");
        return (-1);
    }
    pcl::PLYWriter writer;
    writer.write<pcl::PointXYZI> (output_filename, *cloud, false);
    // writer.write(ply_path, cloud, Eigen::Vector4f::Zero(), Eigen::Quaternionf::Identity(),true,true);

    return 0;

}


int main(int argc, char **argv){
    PCDtoPLYconvertor(pcd_path,ply_path);
    return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.8)

set(CMAKE_BUILD_TYPE "Release")
# 添加c++ 11标准支持
set(CMAKE_CXX_FLAGS "-std=c++11 -O2")

find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})

add_executable (pcd2ply src/pcd2ply.cpp) 
target_link_libraries(pcd2ply ${PCL_LIBRARIES})

如果遇到编译问题可能是pcl库的版本不同。如果还是无法解决可在评论区留言~