Your error message tells you what you need to do:
error: no matching function for call to 'pcl::visualization::CloudViewer::showCloud(pcl::PointCloud<pcl::PointXYZ>&)'
So, go to the documentation for CloudViewer and see what arguments this member function takes: http://docs.pointclouds.org/1.5.1/classpcl_1_1visualization_1_1_cloud_viewer.html
We see that the required const MonochromeCloud::ConstPtr &cloud not the source link you are passing. This is the typedef of a smart pointer from boost:
typedef boost::shared_ptr<const PointCloud<PointT> > pcl::PointCloud< PointT >::ConstPtr
So, when you create your cloud, you need to wrap it in one of these smart pointers instead of making it a local variable. Something like (unverified):
pcl::MonochromeCloud::ConstPtr cloud(new pcl::PointCloud<pcl::PointXYZ>());
Then, when you go into the variable cloud, it will be of the correct type and you will not receive an error message. You will also have to change cloud.foo to cloud->foo s.
Looking at the second example, he also does this:
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);
ahcox
source share