syntax error near unexpected token (pcd_read) [closed]

asked 2016-02-25 16:39:49 -0500

Miss K gravatar image

updated 2016-02-26 01:18:26 -0500

gvdhoorn gravatar image

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/... )

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

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2018-01-30 22:40:39.312358