I wrote a class with some functionality I want to use in a few of my ROS nodes, but I'm having trouble getting catkin to generate the proper files, or I'm including things wrong, or something... So far, I've been able to get catkin to compile a library from my class, which is a .so file, but then I'm struggling with using this class in any of my nodes because it lacks a .h file. Am I going about this the wrong way?
Here's the CMakeLists.txt that succeeds in generating a library .so file, but no .h file.
cmake_minimum_required(VERSION 2.8.3) project(LogixEIP) find_package(catkin REQUIRED COMPONENTS roscpp ) catkin_package( INCLUDE_DIRS include LIBRARIES LogixEIP CATKIN_DEPENDS roscpp DEPENDS system_lib ) include_directories( ${catkin_INCLUDE_DIRS} ) add_library(LogixEIP src/LogixEIP.cpp ) ## Mark executables and/or libraries for installation install(TARGETS LogixEIP ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) ## Mark cpp header files for installation install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} FILES_MATCHING PATTERN "*.h" PATTERN ".svn" EXCLUDE )
Originally posted by Robot_Cpak on ROS Answers with karma: 71 on 2015-01-28
Post score: 0
Original comments
Comment by William on 2015-01-28:
Do you have a header file? Or are you expecting CMake/catkin to generate one for you? You have to write, install, and include the header file with the class prototype in it for other software to make use of your .so
.
Comment by Robot_Cpak on 2015-01-28:
I was hoping that catkin would generate one for me, is that possible?
Comment by William on 2015-01-28:
No, this is not something catkin nor CMake does. This is a C++ issue. I would suggest looking elsewhere: http://stackoverflow.com/questions/42770/writing-using-c-libraries