Gazebo | Ignition | Community
Ask Your Question

I am trying to write my own plugin, which has its own header file. For its compilation, I am following Plugins 101 tutorials. When I run make command in terminal in build folder, it says "fatal error: myproject.hh: No such file or directory compilation terminated". How to solve this problem ?

asked 2018-06-27 03:12:57 -0500

pk gravatar image

updated 2018-06-27 04:02:10 -0500

Gazebo Version: 7.13.1
Ubuntu 16.04,

Tutorial Link: Plugins 101

File Structure :
Myproject (Folder)
----build (Folder)


cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
find_package(gazebo REQUIRED)


add_library(myproject SHARED

target_link_libraries(myproject ${GAZEBO_LIBRARIES})

I have written a new header file myproject.hh and included it in When I try to compile, it says "myproject.hh not found". What changes should I make to my CMakeLists.txt, so that it recognises the header file. Thanks in advance.

edit retag flag offensive close merge delete


What's the `include` line in ``?

chapulina gravatar imagechapulina ( 2018-06-27 11:05:23 -0500 )edit

cmake looks fine from an amateur pov

tacyon gravatar imagetacyon ( 2018-06-28 01:28:55 -0500 )edit

#include <myproject.hh>

pk gravatar imagepk ( 2018-06-28 05:58:16 -0500 )edit

I add "include_directories(${HEADER_FILES})" to my CMakeLists.txt file and it works.

pk gravatar imagepk ( 2018-06-28 06:01:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-28 03:21:36 -0500

wentz gravatar image

You need to tell the compiler to use your header file. Try to change:

add_library(myproject SHARED


add_library(myproject SHARED myproject.hh)

if this dont fix your problem you should make sure to include your header file like this: #include "myproject.hh"

and not with these <>.

edit flag offensive delete link more


What difference it makes by using " " instead of <> ?

pk gravatar imagepk ( 2018-06-28 05:56:52 -0500 )edit

In general it should work with both. The difference is that <> are used for including system libraries while "" are used for local libraries. Sometimes this could lead to the compiler can't find the include file. Just give it a try with both ways.

wentz gravatar imagewentz ( 2018-06-30 06:01:57 -0500 )edit

I gave it a try with both, "" and <> it didn't work. Thanks a lot for the help ! I added "include_directories(${HEADER_FILES})" to my CMakeLists.txt file and it works.

pk gravatar imagepk ( 2018-06-30 10:59:21 -0500 )edit

Question Tools

1 follower


Asked: 2018-06-27 03:12:57 -0500

Seen: 350 times

Last updated: Jun 28 '18