Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Undefined symbol with plugin

I've been stuck on this issue for an embarrassingly long period of time, and would be very grateful for any help. I'm very new to c++ and CMake, so it's likely I'm overlooking something quite obvious.

When I run Gazebo with a plugin I wrote, plank_drop.cc, I get the following error:

gzserver: symbol lookup error: /home/plugins/build/libPlankDrop.so: undefined symbol: _Z4joinIdENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_4listIT_SaIS7_EEES5_

The symbol's name leads me to believe the issue is in the join function, called within plank_drop.cc, and defined in the extra_functions.cc.

I've added join() to the scope of plank_drop.cc like so:

#include "extra_functions.h"

And the compiler doesn't complain. It never seems to compain at compile time, or link time. It only fails at runtime. I've set this up in my CMakeList.txt like this:

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(PlankDrop SHARED plank_drop.cc)
add_library(CamRecord SHARED cam_record.cc)
add_library(ExtraFunctions SHARED extra_functions.cc extra_functions.h)

target_link_libraries(PlankDrop CamRecord ExtraFunctions ${GAZEBO_LIBRARIES})

The relevant parts of my source code is here. All of my solutions just introduce new issues that are equally confusing.