CLion doesn't see header generated by service
I have a fresh install of all - Ubuntu, CLion and ROS Melodic, and I am having troubles with how CLion handles the headers
I have a package called maze_controller, which contains a custom service and a robot controller
compiling works without a problem, but CLion, for some reason, reports that it can't find a message.h header, even tho it is in devel/include and the code compiles fine despite that... as you might already guess, the message used is also reported as unknown, but catkin compiles the code juuust fine...
is there a way to fix this? I don't remember having such issue before I updated everything (coming from Lunar and Ubuntu 16.04)
yes, CLion is opened from a terminal with sourced workspace yes, project was built before yes, I tried deleting .idea
CMake for the package:
cmake_minimum_required(VERSION 2.8.3)
project(maze_controller)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
message_generation
roscpp
std_msgs
)
add_service_files(
FILES
movement.srv
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES maze_controller
CATKIN_DEPENDS roscpp std_msgs message_runtime
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_library(${PROJECT_NAME} src/virtual_controller.cpp src/real_controller.cpp)
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
add_executable(${PROJECT_NAME}_test_sim src/virtual_controller_test.cpp)
target_link_libraries(${PROJECT_NAME}_test_sim ${PROJECT_NAME})
add_executable(${PROJECT_NAME}_test src/real_controller_test.cpp)
target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME})
## Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME}
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
)
Please attach your screenshot to the question directly. I've given you sufficient karma for that.
I don't know whether CLion needs it, but there is no
add_dependencies(..)
anywhere in yourCMakeLists.txt
.Refer to Catkin documentation: Building messages, services or actions for why this needed and how to add it.
@gvdhoorn I just went over http://wiki.ros.org/catkin/CMakeLists... and made slightly different CMake file (basically the same, but with the add_dependencies), I will update question asap
And just to make sure: you have seen wiki/IDEs - CLion?
yes... I never had this problem before when I was using Ubuntu 16.04 and Lunar, however I just switched to 18.04 and Melodic... I am also using CLion only as an editor, and still manually compile using catkin_make... I use CLion for it's autocomplettion, but it doesn't work with the custom messages/services anymore for some reason