Roscpp error - rosc++ in 5 days course

Hello,

I hope you are good. I am getting the error in the picture below for rosc++ in 5 days course. It doesnt recognize ros for some reason so i am unable to launch the simple.cpp script. Please help me solve this problem, thank you.

Hi Elena,

Try with

#include "ros/ros.h"

Also make sure that you added the script as an executable to CMakeLists.txt

Are you getting any errors when you try to launch the script? You may ignore those errors in the IDE if they are not related to the errors you get (if any) while running the script.

The IDE ‘header file not found’ error is a known issue and we are looking into it.

okay i would try this, thank you.

Yes @bayodesegun i get errors when i launch the script.

The errors are not necessarily related. What errors are you getting?

Hi @Yelaina ,

we’ve just solved the autocompletion for C++ issue.

Now it should work properly.

It may happen that the IDE may not autocomplete just instantly because it may be parsing the include files, but after some seconds it should work fine.

Thanks for reporting it.

Thank you @ralves. I have tried launching the program again and got the below error.

user:~$ roslaunch my_package my_package_launch_file.launch
… logging to /home/user/.ros/log/143d52ea-0a8d-11ec-9333-0242ac170007/roslaunch-1_xterm-1599.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://1_xterm:37187/

SUMMARY

PARAMETERS

  • /rosdistro: noetic
  • /rosversion: 1.15.9

NODES
/
ObiWan (my_package/simple.cpp)

ROS_MASTER_URI=http://1_simulation:11311

RLException: Unable to launch [ObiWan-1].
If it is a script, you may be missing a ‘#!’ declaration at the top.
The traceback for the exception was written to the log file
[ObiWan-1] killing on exit

1 Like

The error simply means your node is still not set up properly. Please ensure you:

  1. Make the modifications necessary in CMakeLists.txt and package.xml. Please double-check for correct spelling and case (names are case-sensitive).
  2. Compile the package.
cd ~/catkin_ws
catkin_make
  1. Source
cd ~/catkin_ws
source devel/setup.bash

Okay I would check it again @bayodesegun , thank you.