Catkin_make error: No such file or directory of a customized header file
Hello,
I encountered a catkin_make error and already spent several days of trying to solve it but I could not make it. I hope you guys have any ideas on this. I am using Ubuntu 14.04 and ROS Indigo version.
The error message I got when doing catkin_make is
fatal error: AA/AAA.hpp: No such file or directory
, which is placed in a header file I made (BBB.hpp
as in the below) with #include <AA/AAA.hpp>
.
The following is how my source folder is organized roughly.
/devel
/build
/src
CMakeLists.txt
/A
/AA
CMakeLists.txt
package.xml
/src
AAA.cpp
/include
AAA.hpp
/B
/BB
CMakeLists.txt
package.xml
/src
BBB.cpp
/include
BBB.hpp
A
and B
are directories that include corresponding multiple packages in each of them. What I have basically been trying to do is to use functions of AA
package from BB
package. Therefore, BB
package's CMakeLists.txt
and package.xml
files include necessary parts to work with AA
package. In the bottom, I also attached brief structure of CMakeLists of both A
and B
.
The weird thing is when I included #include <AA/AAA.hpp>
in BBB.cpp
file, it worked fine. However, when included in BBB.hpp
file, I got the above error, which is fatal error: AA/AAA.hpp: No such file or directory
. The followings are CMakeLists of A
and B
. Do you guys have any insights on this? I need to define #include <AA/AAA.hpp>
in BBB.hpp
file. I really appreciate your help in advance!
CMakeLists.txt of AA
cmake_minimum_required(VERSION 2.8.3)
project(AA)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
find_package(catkin REQUIRED COMPONENTS
)
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
${PROJECT_NAME}
CATKIN_DEPENDS
DEPENDS
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_library(${PROJECT_NAME}
src/AA_main.cpp
)
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
)
install(TARGETS ${PROJECT_NAME}
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 "*.hpp"
)
install(
DIRECTORY doc
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
CMakeLists.txt of BB
cmake_minimum_required(VERSION 2.8.3)
project(BB)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
find_package(catkin REQUIRED COMPONENTS
roscpp
AA
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS
# DEPENDS system_lib
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_library(
${PROJECT_NAME}
src/BB_main.cpp
)
add_dependencies(
${PROJECT_NAME}
DEPS ${${PROJECT_NAME}_EXPORTED_TARGETS}}
)
target_link_libraries(
${PROJECT_NAME}
${catkin_LIBRARIES}
)