Ask Your Question

How to add ROS to path in VS Code?

asked 2017-03-09 01:56:18 -0600

updated 2017-11-23 02:11:39 -0600


Is anyone using VS Code to program in ROS? I kind of like this IDE ( haven't used it earlier ) and want to use it as it comes with a lot of features which I like.

My question is when I include <ros/ros.h> it puts a green squiggle below it, and also for service file generated headers it can't really locate them. Any suggestions on how to add on to the path to avoid this.

To be noted, there is no problem in building it as it is already in the path of Linux terminal...

edit retag flag offensive close merge delete



There isn't a section for VS Code on the ROS IDE wiki, but the instructions for one of the other IDEs might provide some hints.

ahendrix gravatar imageahendrix ( 2017-04-10 01:46:28 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2017-11-11 13:08:02 -0600

clyde gravatar image

The IDE wiki now includes an entry for VSCode, which points to a ROS extension. Among other things, this extension will add the appropriate include paths. I tried this and it works nicely.

edit flag offensive delete link more

answered 2018-07-15 18:14:40 -0600

amer gravatar image

In addition to clyde answer:

1- Open VSCode and (Ctrl+Shift+X) and search for ROS

2- Install ( ROS VSCode Extension )

3- Restart VSCode

4- Make sure to open your workspace ex: file ->openfolder ->catkin_ws

5- The extension will pop up a msg to configure your ROS distro if it cants configure it automatically

6- Also you can use the terminal from VSCode (Ctrl+~) as usual ubuntu terminal

7- Build your catkin workspace at least once from this terminal

8- You can include <ros/ros.h> in your files and you shouldn't see green squiggle below if everything is configured properly.

9- At the left bottom of VSCode you will find [x ROS Master] that's mean ROS core is not running try to run $ roscore from the terminal in VSCode and notice [✔ ROS Master]

edit flag offensive delete link more


I am trying with simple talker.cpp program. I could not find a way to RUN it. I have followed all your steps. When I debug I get this following error: Unable to start debugging. Program path '/home/catkin_ws/src/beginner_tutorials/scripts/talker.cpp' is missing or invalid.

murali1842 gravatar imagemurali1842 ( 2018-10-26 16:23:57 -0600 )edit

GDB failed with message: "/home/catkin_ws/src/beginner_tutorials/scripts/talker.cpp": not in executable format: File format not recognized

murali1842 gravatar imagemurali1842 ( 2018-10-26 16:25:06 -0600 )edit

This may occur if the process's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine.

murali1842 gravatar imagemurali1842 ( 2018-10-26 16:25:20 -0600 )edit

Can you give me some suggestions please...

murali1842 gravatar imagemurali1842 ( 2018-10-26 16:25:38 -0600 )edit

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


Asked: 2017-03-09 01:56:18 -0600

Seen: 6,798 times

Last updated: Nov 23 '17