How to include header file from different workspace?
Hey, I am new to ROS and its my first post, so I hope everything is understandable.
I am trying to include a header file in the package (B) from a different package (A) which is in a different workspace. I can include messages from the package. I overlayed the workspace and added the the packge in the CMakeLsts.txt
find_package(catkin REQUIRED COMPONENTS
A
)
catkin_package(
CATKIN_DEPENDS
A
)
install (DIRECTORY include/${A}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h")
add_library(library A/src/AClass.cpp)
add_executable(ClassIncludeAClass src/ClassIncludeAClass.cpp)
target_link_libraries(ClassIncludeAClass ${catkin_LIBRARIES} library )
ClassIncludeAClass .cpp
#include "A/AClass.h"
When I include the whole path to the file the Compiler has undefined references to functions of the class AClass.
I found the following question https://answers.ros.org/question/2019... to include a header form the same Workspace but a different package.
Thanks in advance for any help!
I think you are missing this:
include_directories(${catkin_INCLUDE_DIRS})
which will tell the compiler to look for include files also in the include folders of the packaged that you found infind_package
.