syntax error in int main

asked 2014-04-15 22:31:12 -0500

RSA gravatar image

updated 2016-10-24 08:54:33 -0500

ngrennan gravatar image

I got a syntax error for this code :

#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <geometry_msgs/Twist.h> 
#include <turtlesim/Spawn.h>
#include "sensor_msgs/PointCloud.h"
#include "tf/message_filter.h"
#include "laser_geometry/laser_geometry.h"
#include <Eigen/Eigen>
#include "std_msgs/String.h"

int main(int argc, char** argv)
{
ros::init(argc, argv, "my_tf_listener");
ros::NodeHandle node;
    return 0;
} // end of the main

The error is syntax error near unexpected token `('

What is the possible solution ?

edit retag flag offensive close merge delete

Comments

Where exactly is the error and what is the literal error message? Is this the complete source? Did you include ros/ros.h?

dornhege gravatar image dornhege  ( 2014-04-16 00:28:46 -0500 )edit

The error in the line int main(int argc, char** argv) and yes I have ros/ros.h

RSA gravatar image RSA  ( 2014-04-16 02:18:56 -0500 )edit
2

Please provided a cut and paste of your error message as well as a reproducable example with your includes. It's quite possible there's invalid code in your includes.

tfoote gravatar image tfoote  ( 2014-04-16 03:49:04 -0500 )edit

I edited the question by adding the included library.. I cant add pic because I dont have enough points. btw, I am new in ROS

RSA gravatar image RSA  ( 2014-04-16 09:43:18 -0500 )edit

Hi, how did you solve it? I met the same problem

Glen gravatar image Glen  ( 2014-07-19 12:24:52 -0500 )edit