Unable to include C++ header file while compiling
There are 2 files in my package
- A c++ class file (example_ros_class.cpp)
roscpp file that uses the header of the first file (implementation.cpp)
using catkin_make, i receive this error code
Here's the error code
fatal error: example_ros_class.h: No such file or directory
#include "example_ros_class.h"
I have tried to follow this documentation
- https://docs.ros.org/api/catkin/html/...
- http://answers.ros.org/question/65716...
- http://answers.ros.org/question/45422...
and so fort
Here's my CMake
cmake_minimum_required(VERSION 2.8.3)
project(eg_ros_class)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES eg_ros_class
CATKIN_DEPENDS roscpp std_msgs
DEPENDS system_lib
)
##BUILD##
include_directories(
include
src/eg_ros_class
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${GSTREAMER_INCLUDE_DIRS}
)
add_library(eg_ros_class src/example_ros_class.cpp)
add_executable(eg_ros_class_exe src/example_ros_class.cpp)
target_link_libraries(eg_ros_class ${catkin_LIBRARIES}, )
add_executable(implementation_exe src/implementation.cpp)
target_link_libraries(implementation_exe ${catkin_LIBRARIES})
add_dependencies(implementation_exe eg_ros_class_generate_messages_cpp)
##Install##
catkin_package(INCLUDE_DIRS include
LIBRARIES eg_ros_class)
install(TARGETS eg_ros_class
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)