Failed to add library to rqt plugin
I have recently written an rqt plugin gui in C++ based on the rqt_image_view plugin.
Everything was working fine until I decided to add another C++ file to my project. This file contains basically a set of useful functions and classes.
After adding it as a library in the CMakeLists.txt, catkin_make is working fine and I am getting no build error.
Moreover, as long as I don't use any functionality from that source file, my plugin loads and works fine. And even if I use stuff from the associated header file, still the plugin loads and works fine.
The issue happens when I actually use that source file in my plugin code. What happens is that although everything still builds, the plugin simply refuses to load, and I get this error message:
RosPluginlibPluginProvider::load_explicit_type(myGUI) failed creating instance PluginManager._load_plugin() could not load plugin "myGUI": RosPluginlibPluginProvider.load() could not load plugin "myGUI"
I am guessing that it might be related to the plugin.xml since there I specify the library path to be that of the gui only. Should I maybe add the path of the library related to my source file? how to do that?
Note that I currently have 2 add_library statement in my CMakeLists.txt: one for the gui and one for the added source file. If I add both of them in one add_library statement, the plugin fails to load even if I don't use the code from the additional source file.
EDIT
This is the relevant part of my CMakeLists.txt:
add_library(helperLib src/additionalSourceFile.cpp)
include_directories(${rqt_my_gui_INCLUDE_DIRECTORIES} ${catkin_INCLUDE_DIRS})
add_library(${PROJECT_NAME} ${rqt_my_gui_SRCS} ${rqt_my_gui_MOCS} ${rqt_my_gui_UIS_H})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} helperLib)
And the plugin.xml: (I am guessing the 1st line should be modified in some way to include the other helper library path)
<library path="lib/librqt_my_gui">
<class name="myGUI" type="rqt_my_gui::myGUI" base_class_type="rqt_gui_cpp::Plugin">
<description>
A GUI plugin
</description>
<qtgui>
<group>
<label>Robot Tools</label>
</group>
<label>My GUI</label>
<icon type="theme">applications-other</icon>
<statustip>User interface to allow interaction.</statustip>
</qtgui>
</class>
</library>
Sharing your code might help others to help you.
Added code in the edit... I really hope that someone can help!