Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

GUI Plugin linker error: undefined symbol


I tried to implement a GUI Plugin for Gazebo11 client. As a baseline I used tutorial (here).

Building went fine, however, I encountered some problems, when i tried to run the plugin with gzclient --verbose --gui-client-plugin

Error was:

[Err] [Plugin.hh:178] Failed to load plugin /home/user/catkin_ws/devel/lib/ undefined symbol: _ZTVN6gazebo15MyGUIPluginE

I believe it was a linker problem and has to do something with my code structure, which is:


My CMakeLists.txt is:

cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)

if(POLICY CMP0100)
  cmake_policy(SET CMP0100 NEW)


find_package (Qt5Widgets REQUIRED)
find_package (Qt5Core REQUIRED)
find_package(Protobuf REQUIRED)
find_package(gazebo REQUIRED)

include_directories(include SYSTEM ${GAZEBO_INCLUDE_DIRS}
link_directories(include ${GAZEBO_LIBRARY_DIRS}


QT5_WRAP_CPP(headers_MOC include/GUICameraPlugin.hh) # This solved my problem <--------------

add_library(mygui_plugin SHARED ${headers_MOC}
target_link_libraries(mygui_plugin ${GAZEBO_LIBRARIES}

There is a line marked, which solved my problem. I found this somewhere in Gazebo source code, but I don't know, how it works, why it helped and most importantly, is this the correct solution? Interesting also is, that if I remove Q_OBJECT from my header file class definition, the problem disappears.

I am not an expert on CMakeLists, so I most probably have many unnecessary things in my CMakeList. I would appreciate any comments about those, but I am very curious about the main problem. Also, if someone deals with similar problem, this might be helpful.

Thanks for any notes and ideas!