ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

fatal error: rosconsole/macros_generated.h: No such file or directory

asked 2018-06-25 15:13:31 -0500

baldguy99 gravatar image

Hello I am following the ROS tutorials, trying to compile the c++ subscriber using the code that was on the tutorial at This link. I have gotten it to successfully compile before but now I cannot since I have reinstaled Ubuntu 16.04 and ROS Kinetic.


alex@alex-S500CA:$ g++ main2.cpp -o b
In file included from /usr/include/ros/ros.h:40:0,
                 from main2.cpp:1:
/usr/include/ros/console.h:570:41: fatal error: rosconsole/macros_generated.h: No such file or directory
compilation terminated.

I went into "console.h" and commented out line #541 where it includes this header and when I did that I got a separate error:


alexander@alexander-S500CA:$ g++ main2.cpp -o b
In file included from /usr/include/ros/ros.h:45:0,
                 from ./roscpp/main2.cpp:3:
/usr/include/ros/node_handle.h:52:34: fatal error: xmlrpcpp/XmlRpcValue.h: No such file or directory
compilation terminated.

I would greatly appreciate anyone's guidance on resolving this.

edit retag flag offensive close merge delete

Comments

1

Please update your question to include your cmakelists and cpp files.

stevemacenski gravatar image stevemacenski  ( 2018-06-25 17:59:35 -0500 )edit

I second @smac. Also, I'd highly recommend to follow the suggested approach with catkin_make or catkin build...

mgruhler gravatar image mgruhler  ( 2018-06-26 00:53:14 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-26 01:47:03 -0500

kunaltyagi gravatar image

The issue is that you are not passing in the correct location for g++ to search for headers.

If you don't want to use catkin as a build tool, you need to tell gcc where to find the headers and libraries. Use -i /opt/ros/version-of-ros/include -L /opt/ros/version-of-ros/lib as a starting point and keep adding the libraries and other locations as required (eg: -lpthread)

Or simply modify CMakeLists.txt created by catking_create_pkg <you-pkg-name> roscpp roslib. (Though roslib isn't compulsory)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-06-25 15:13:31 -0500

Seen: 1,021 times

Last updated: Jun 26 '18