March 2018
Intermediate to advanced
1396 pages
42h 14m
English
In order to load the class of plugins dynamically, we have to export each class using a special macro called PLUGINLIB_EXPORT_CLASS. This macro has to put in any CPP file that consists of plugin classes. We have already defined the plugin class, and in this file we are going to define the macro statement only.
Locate the calculator_plugins.cpp file from the chapter_5_codes/pluginlib_calculator/src folder, and here is how we export each plugin:
#include <pluginlib/class_list_macros.h> #include <pluginlib_calculator/calculator_base.h> #include <pluginlib_calculator/calculator_plugins.h> PLUGINLIB_EXPORT_CLASS(calculator_plugins::Add, calculator_base::calc_functions);
Inside ...