Home | Tutorials | Wiki | Issues
Ask Your Question

Using Gazebo Plugin with .h File Type

asked 2018-03-14 17:10:54 -0600

stan gravatar image

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)

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? P.s. I'm trying to use this plugin: https://github.com/jhu-lcsr-forks/gaz...

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-03-14 20:21:53 -0600

sloretz gravatar image

CMake couldn't figure out what language your file was written in. I couldn't find the CMake documentation about how it guesses what language a file is written in, but this stackoverflow post has more info. You can tell CMake the language explicitly by setting a property on the library target.

Add this after the call to add_library

set_target_properties(gazebo_ros_moveit_planning_scene PROPERTIES LINKER_LANGUAGE CXX)

Side note, Is all the code for your gazebo plugin in gazebo_ros_moveit_planning_scene.h? Often code is divided into a header and source file. If all the code is in that file then it is more common to name it .cpp or .cc. The extension .h is usually given to C header files.

edit flag offensive delete link more


Hi sloretz, thanks for the swift response. I am using the open-source code on github that I put the link at the bottom of my question. I am new to Gazebo and am not sure if all the code for the gazebo plugin is in that .h file. Could you please give me a few pointers? Thanks!

stan gravatar imagestan ( 2018-03-14 21:43:17 -0600 )edit

There is a .cpp file with the same name in the src folder.

Raskkii gravatar imageRaskkii ( 2018-03-16 02:33:47 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-03-14 17:10:54 -0600

Seen: 96 times

Last updated: Mar 14