Ask Your Question

nav_msgs/Odometry.h: No such file or directory

asked 2011-03-17 08:59:53 -0500

SeanPayne gravatar image

updated 2011-03-17 10:33:41 -0500

I've just tried to add odometry to my node and when building I get the error: [ 69%] Built target rosbuild_precompile [ 73%] Building CXX object CMakeFiles/client.dir/src/client/RosDriver.o /home/sean/ros/sigevo_champ/src/client/RosDriver.cpp:19: fatal error: nav_msgs/Odometry.h: No such file or directory
compilation terminated.

I expect that it should be able to include that file because I specified nav_msgs as a dependency in my manifest.xml.

I've been trying to debug this and I'm stuck.

My manifest does include the nav_msgs package.

I haven't had issues with std_msgs. I'm using diamondback source install.

What is the next best step? Is there a way to log exactly where the build is searching for files? What would you do?

I tried Sabrina's suggestions but after this check it still fails to build Can you find nav_msgs with "rospack find nav_msgs"? -> Yes Is nav_msgs compiled? -> Yes Can you access the file with "rosed nav_msgs Odometry.h"? -> Yes

edit retag flag offensive close merge delete


Can you find nav_msgs with "rospack find nav_msgs"? Is nav_msgs compiled? Can you access the file with "rosed nav_msgs Odometry.h"?
Sabrina gravatar image Sabrina  ( 2011-03-17 09:58:07 -0500 )edit
$ rospack find nav_msgs /home/sean/ros/common_msgs/nav_msgs
SeanPayne gravatar image SeanPayne  ( 2011-03-17 10:24:30 -0500 )edit

I'm facing a similar problem now, on ROS hydro. However, for me nav_msgs exists but did not compile or run. What are the possible reasons ?

Also, I'd like to understand CmakeCache.txt, because the path entered seems to be correct.

Adithya Ramachandran gravatar image Adithya Ramachandran  ( 2015-11-21 16:36:08 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2011-03-17 10:52:05 -0500

SeanPayne gravatar image

I figured out a tip for this type of problem: Look at CMakeCache.txt in the root of your package - it shows all of the directories being searched by rosmake

And a solution to my specific problem: Delete CMakeCache.txt - for some reason mine was broken and this is why the compile was failing.

So in general, if this type of issue comes up again and I've done the sort of things suggested by Sabrina above - I'll just delete my CMakeCache.txt to see if it resolves the issue - else debug further into CMakeCache.txt

edit flag offensive delete link more


If you can find a way to reproduce this it is ticketable. A rebuild should scan all the upstream packages for changes. Did you not have nav_msgs installed at some point and then retry building after installing it?
tfoote gravatar image tfoote  ( 2011-03-17 12:24:13 -0500 )edit
I definitely progressively installed components while bringing my stuff up (adding things to my manifest over time) and would also speculate that is part of the puzzle. If I can narrow the issue down I'll post a ticket.
SeanPayne gravatar image SeanPayne  ( 2011-03-18 05:37:04 -0500 )edit

i had the same problem, and deleting CMakeCache.txt solved my problem.

searchrescue gravatar image searchrescue  ( 2012-08-07 05:01:28 -0500 )edit

I am having a similar problem. Running rosmake [my_package] gives me an error like "nav_msgs/GridCells.h: No file or directory" But in my case the problem is that the header "GridCells.h" really doesn't exist. Instead, I can find the same file name for a .msg (GridCells.msg). I feel like I should compile nav_msgs such that those .h files will appear, but I don't know how to do that (rosmake doesn't help). Can anyone help me out on that???

lucasbpro gravatar image lucasbpro  ( 2014-07-02 14:47:31 -0500 )edit

lucasbpro, did you get the solution ?? I have similar problem. while building the package, it shows the error nav_msgs/Odometry.h is missing. I searched as per instructed above ! there is a file Odometry.msg not Odometry.h

hpurohit gravatar image hpurohit  ( 2016-10-27 15:52:22 -0500 )edit

lucasbpro and hemang_purohit did you get the solution? I have a similar problem. while building the package, i have the error: fatal error: nav_msgs/SetMap.h: No such file or directory. compilation terminated. thanks

Diamond gravatar image Diamond  ( 2016-12-14 05:30:50 -0500 )edit

answered 2021-02-22 03:03:00 -0500

bigbellmercy gravatar image

In my case, such errors disappeared after I added nav_msgs into the find_package() and generate_messages() in the CMakeFile.txt of the package of the problem.

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: 2011-03-17 08:59:53 -0500

Seen: 3,172 times

Last updated: Feb 22