ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

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

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

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 -0600 )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 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 933 times

Last updated: Jun 26 '18