1

When I tried compiling a Gazebo plugin that is a header file (with .h file extension), it says:

CMake Error: CMake can not determine linker language for target: gazebo_ros_moveit_planning_scene
CMake Error: Cannot determine link language for target "gazebo_ros_moveit_planning_scene".

The following is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
find_package(gazebo REQUIRED)
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
list(APPEND CMAKE_CXX_FLAGS "${GAZEBO_CXX_FLAGS}")

add_library(gazebo_ros_moveit_planning_scene SHARED gazebo_ros_moveit_planning_scene.h)
target_link_libraries(gazebo_ros_moveit_planning_scene ${GAZEBO_LIBRARIES})

Any suggestions for a fix?

stan25
  • 464
  • 2
  • 5
  • 16
  • It's not a Gazebo issue but rather the fact (as far as I know) that you can't create a library from a header file only. If it were possible many header-only libraries (here library is used as a collection of header files and not actual static or dynamic library files) would have switched to being actual libraries since header-only stuff has more disadvantages then advantages. You can include the header into an other wise empty source file, which should allow you to create the `so` however this doesn't make much sense. – rbaleksandar Mar 14 '18 at 22:13
  • Possible duplicate of [CMake cannot determine linker language for target](https://stackoverflow.com/questions/16655705/cmake-cannot-determine-linker-language-for-target) – Tsyvarev Mar 15 '18 at 08:42

0 Answers0