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

VS code can't find the headerfiles even when workspace compiles without error

asked 2020-03-09 10:46:34 -0600

dj95 gravatar image

updated 2022-01-22 16:10:24 -0600

Evgeny gravatar image

Hi,

I've been having this error where the squiggles in vscode don't go away when I try to include headerfiles for custom messages and services. I am able to compile my workspace, I can see the header file for the service created (with response.h and request.h), I can do rossrv show __________ to see the content of my header files as well. It's just that I can't get rid of the red squiggle because of which I can't use autocomplete.

Does anyone know what can I do?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
6

answered 2020-03-11 09:07:02 -0600

LazyEngineerToBe gravatar image

There's a great tutorial on how to setup VS-Code properly to work with ROS at https://github.com/RoboGnome/VS_Code_ROS

edit flag offensive delete link more

Comments

This looks great, Thanks.

dj95 gravatar image dj95  ( 2020-03-11 10:04:38 -0600 )edit

don't forget to upvote an answer and close your question ;)

LazyEngineerToBe gravatar image LazyEngineerToBe  ( 2020-03-11 10:07:59 -0600 )edit
3

answered 2020-03-09 13:41:19 -0600

duck-development gravatar image

You have to add the proper include path for the msgs the you should handle those

The config file is: c_cpp_properties.json See here

https://code.visualstudio.com/docs/cp...

edit flag offensive delete link more

Comments

Okay, I'll have a look, Thanks!

dj95 gravatar image dj95  ( 2020-03-09 14:19:55 -0600 )edit

you may look at https://marketplace.visualstudio.com/... looks interresting

duck-development gravatar image duck-development  ( 2020-03-09 16:00:26 -0600 )edit

I have that extension already, still doesn't get the header files. Btw, do you know if adding these lines to my CMakelist would be helpful or not?

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES generate_waypoint
  CATKIN_DEPENDS geometry_msgs roscpp rospy std_msgs tf visualization_msgs
  DEPENDS system_lib
)

I usually just have all of them commented out, resulting in catkin_package()

And also this:

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

By default the include is commented out though, resulting in:

include_directories(
  # include
  ${catkin_INCLUDE_DIRS}
)
dj95 gravatar image dj95  ( 2020-03-10 10:19:36 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-09 10:46:34 -0600

Seen: 9,156 times

Last updated: Mar 11 '20