Ask Your Question
0

where are the headers' implementations on ubuntu?

asked 2021-09-19 01:17:58 -0500

Ben222 gravatar image

updated 2021-09-19 01:18:30 -0500

After installing the ROS noetic on Ubuntu, my understanding is that the implementation of header files, that is the .cpp files should be copied in a directory, but I cannot find them? For example, I can locate node_handle.h, but there is no node_handle.cpp on my machine?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-09-19 01:39:18 -0500

gvdhoorn gravatar image

After installing the ROS noetic on Ubuntu, my understanding is that the implementation of header files, that is the .cpp files should be copied in a directory [..]

Do you mean you expect the source code (which I believe is what you are referring to by "implementation of header files") should be part of the set of files that gets installed by apt?

If so, that's not correct.

apt only installs binary artefacts such as libraries (.so) and binaries (they typically don't have an extension on Linux, but are the executables of nodes and utilities/tools). Same for yum and dnf.

The libraries, together with the headers, are sufficient to be able to write and build new ROS applications, as the compiler needs the headers (to know which functions, classes etc exist) and the linker needs the libraries (to have access to the executable code making up the implementation of the functionality "promised" by the headers).

If you were to install (or build) ROS from source, then you would have both the headers and the sources (ie: .cpp). But even then the .cpp files do not get installed. They are only part of the source distribution of packages.

edit flag offensive delete link more

Comments

1

@Ben222 Nearly all the c++ and python files are publicly available on github.com. You need to figure out which ros package the include file belongs to, then find the associated package page on ros.org (usually using a search engine.) That web page will have a "source code" url to the github repo. Then you use git clone to download the code. Once you have the repo locally, don't forget to checkout the correct version of the code that matches your ros release.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-09-19 07:14:20 -0500 )edit

If you'd like to find the source repository, you could take a look at #q246775. For the more manual approach (similar to what you describe @Mike Scheutzow ): #q381559.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-19 07:22:59 -0500 )edit
1

@gvdhoorn I'm amused: I've been using ros for years and never heard of roslocate! It's not even present in our local ros trees.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-09-19 08:22:56 -0500 )edit

@Mike Scheutzow : I figured as much :)

It's part of rosinstall (python3-rosinstall for Noetic). You may not have that installed.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-19 09:38:29 -0500 )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

Stats

Asked: 2021-09-19 01:17:58 -0500

Seen: 48 times

Last updated: Sep 19 '21