# Revision history [back]

### GUI Plugin linker error: undefined symbol

Hi,

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 libmygui_plugin.so.

Error was:

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


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

 /plugin
CMakeLists.txt
/src
MyGUIPlugin.cc
/include
MyGUIPlugin.hh


My CMakeLists.txt is:

cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(gui_plugin)

if(POLICY CMP0100)
cmake_policy(SET CMP0100 NEW)
endif()

set (CMAKE_AUTOMOC ON)

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

include_directories(include SYSTEM ${GAZEBO_INCLUDE_DIRS}${Qt5Core_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include${PROJECT_SOURCE_DIR}/src
${catkin_INCLUDE_DIRS}) link_directories(include${GAZEBO_LIBRARY_DIRS}
${PROJECT_SOURCE_DIR}/include${PROJECT_SOURCE_DIR}/src
)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${GAZEBO_CXX_FLAGS}")

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

add_library(mygui_plugin SHARED ${headers_MOC} src/MyGUIPlugin.cc) target_link_libraries(mygui_plugin${GAZEBO_LIBRARIES}
${roscpp_LIBRARIES}${Qt5Core_LIBRARIES}
\${PROTOBUF_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!