title: PCL: Visualize a point cloud
body: <p>I'm trying to visualize a point cloud using <a href="http://pointclouds.org/" rel="nofollow noreferrer">PCL</a> CloudViewer. The problem is that I'm quite new to C++ and I have found two tutorials <a href="https://pcl.readthedocs.io/projects/tutorials/en/latest/writing_pcd.html#writing-pcd" rel="nofollow noreferrer">first</a> demonstrating the creation of PointCloud and <a href="https://pcl.readthedocs.io/projects/tutorials/en/latest/cloud_viewer.html#cloud-viewer" rel="nofollow noreferrer">second</a> demonstrating the visualization of a PointCloud. However, I'm not able to combine these two tutorials.</p>
  <p>Here is what I have come up with:</p>
  <pre><code>#include &lt;iostream&gt;
  
  #include &lt;pcl/io/pcd_io.h&gt;
  #include &lt;pcl/point_types.h&gt;
  #include &lt;pcl/visualization/cloud_viewer.h&gt;
  
  int main (int argc, char** argv)
  {
    pcl::PointCloud&lt;pcl::PointXYZ&gt; cloud;
    
    // Fill in the cloud data
    cloud.width    = 5;
    cloud.height   = 1;
    cloud.is_dense = false;
    cloud.points.resize (cloud.width * cloud.height);
  
    for (size_t i = 0; i &lt; cloud.points.size (); ++i)
    {
      cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
      cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
      cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
    }
  
    pcl::visualization::CloudViewer viewer (&quot;Simple Cloud Viewer&quot;);
    viewer.showCloud (cloud);
  
    while (!viewer.wasStopped ())
    {
    }
  
    return (0);
  }
  </code></pre>
  <p>but that even do not compile:</p>
  <pre><code>error: no matching function for call to   
  ‘pcl::visualization::CloudViewer::showCloud(pcl::PointCloud&lt;pcl::PointXYZ&gt;&amp;)’
  </code></pre>