Robotics StackExchange | Archived questions

syntax error near unexpected token (pcd_read)

Hi there,

I am new in ros and i am having trouble with the Reading Point Cloud data from PCD files tutorial . I am using the code in this link (http://pointclouds.org/documentation/tutorials/reading_pcd.php)

When i try to run the program it gives me this:

line 5: syntax error near unexpected token `('

line 5: ` int main(int argc, char** argv){'

I don't understand why. BTW i am using hydro.

my c code is:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

int
main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
    return (-1);
  }
  std::cout << "Loaded "
            << cloud->width * cloud->height
            << " data points from test_pcd.pcd with the following fields: "
            << std::endl;
  for (size_t i = 0; i < cloud->points.size (); ++i)
    std::cout << "    " << cloud->points[i].x
              << " "    << cloud->points[i].y
              << " "    << cloud->points[i].z << std::endl;

  return (0);
}

thank you in advance

Asked by Miss K on 2016-02-25 17:39:49 UTC

Comments

Answers