ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ROS-friendly Visual Studio Code extensions

asked 2019-03-15 00:55:11 -0500

KenYN gravatar image

As a recent convert to Visual Studio Code from VIM on Linux (GitLens is wonderful!) the biggest problem is that in a multi-package project it cannot find other packages to resolve #include <my_other_package/foo.h>. Has anyone found a useful extension for handling this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-15 01:44:17 -0500

Dyson sphere gravatar image

updated 2019-03-17 23:13:34 -0500

I dont think there is any (ROS) extension that fixes your particular problem but VS Code has its own way of dealing with including path to external libraries. You can edit your .vscode/c_cpp_properties.json file which gets created when you open your packet directory with VSCode. It allows you to define includePath for VSCode to use when you want to include external library (like /usr/include, ros system includes etc.) and access its exposed variables/functions. It edits this on its own to some extent, but you can always edit it yourself like this:

"includePath": [
            "PATH_TO_MY_OTHER_PACKAGE/include",   <--- if you keep your headers here 

This will not link your build to any of libraries you include into path, it is just a useful feature for VS Code to help developers get access to libraries and get rid of annoying editor warnings in bigger environments where you have to link external libraries.

Not related to your direct problem but there is also this extension for ROS which might help you with its own features and I personally use this extension to get all other c++ related syntax highlighting and features and I would recommended it to everyone.

EDIT: Under ROS extension I mentioned earlier this is stated:

Automatically add the ROS C++ include and Python import paths.

Im not sure how much it does things on its own, but It could be helpful to have it.

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



Asked: 2019-03-15 00:55:11 -0500

Seen: 1,784 times

Last updated: Mar 17 '19