Subclass a robot controller
Posted: Fri Apr 03, 2015 5:08 pm
Hi, I'd like to have a basic robot controller class, then subclass it for specific controllers. I am struggling to make the makefile instructions for this in the controllers/CMakeLists.txt file of my argos project.
If you had only a single class, you would do:
So for a new subclass of baseRobot, called localBroadcaster, I am trying:
But I keep getting linkage errors like:
How could I do this?
If you had only a single class, you would do:
Code: Select all
add_library(baseRobot SHARED baseRobot.h baseRobot.cpp)
target_link_libraries(
baseRobot
${GSL_LIBRARIES}
argos3core_simulator
argos3plugin_simulator_actuators
argos3plugin_simulator_footbot
argos3plugin_simulator_genericrobot
argos3plugin_simulator_sensors)
#${GSL_LIBRARIES}
Code: Select all
add_library(baseRobot SHARED baseRobot.h baseRobot.cpp)
target_link_libraries(
baseRobot
${GSL_LIBRARIES}
argos3core_simulator
argos3plugin_simulator_actuators
argos3plugin_simulator_footbot
argos3plugin_simulator_genericrobot
argos3plugin_simulator_sensors)
add_library(localBroadcaster SHARED localBroadcaster.h localBroadcaster.cpp)
target_link_libraries(
baseRobot
${GSL_LIBRARIES}
argos3core_simulator
argos3plugin_simulator_actuators
argos3plugin_simulator_footbot
argos3plugin_simulator_genericrobot
argos3plugin_simulator_sensors)
#${GSL_LIBRARIES}
Code: Select all
Scanning dependencies of target localBroadcaster
[ 40%] Building CXX object controllers/CMakeFiles/localBroadcaster.dir/localBroadcaster.cpp.o
Linking CXX shared library liblocalBroadcaster.dylib
Undefined symbols for architecture x86_64:
"argos::CCI_Controller::~CCI_Controller()", referenced from:
BaseRobot::~BaseRobot() in localBroadcaster.cpp.o