GUI with QT in Catkin [closed]
Hello everyone!
I try to create a qt based gui for my package. Therefore I tried to follow the qt tutorials, but get undefined reference errors. I use an eclipse workspace, which shows the qt_gui_cpp:: functions in the auto complete scheme. Therefore I think it is a problem of definition of the plugin. The errors are:
CMakeFiles/Project_node.dir/src/Gui/gui.cpp.o: In function
Gui::MyPlugin::initPlugin(qt_gui_cpp::PluginContext&)
: Catkin/src/Project/src/Gui/gui.cpp:24: undefined reference toqt_gui_cpp::PluginContext::argv() const'
Catkin/src/Project/src/Gui/gui.cpp:30: undefined reference toqt_gui_cpp::PluginContext::addWidget(QWidget*)'
CMakeFiles/Project_node.dir/src/Gui/gui.cpp.o: In functionrqt_gui_cpp::Plugin::Plugin()'
: /opt/ros/indigo/include/rqt_gui_cpp/plugin.h:57: undefined reference tonodelet::Nodelet::Nodelet()'
CMakeFiles/Project_node.dir/src/Gui/gui.cpp.o: In functionrqt_gui_cpp::Plugin::~Plugin()'
: /opt/ros/indigo/include/rqt_gui_cpp/plugin.h:49: undefined reference tonodelet::Nodelet::~Nodelet()' CMakeFiles/Project_node.dir/src/Gui/gui.cpp.o: In function
void class_loader::class_loader_private::registerPlugin<gui::myplugin, rqt_gui_cpp::plugin="">(std::string const&, std::string const&)':In /opt/ros/indigo/include/class_loader/class_loader_core.h I get the undefined reference
class_loader::class_loader_private::getCurrentlyLoadingLibraryName()'
class_loader::class_loader_private::getCurrentlyActiveClassLoader()'class_loader::class_loader_private::getCurrentlyActiveClassLoader()'
class_loader::class_loader_private::hasANonPurePluginLibraryBeenOpened(bool)'class_loader::class_loader_private::getCurrentlyActiveClassLoader()'
class_loader::class_loader_private::AbstractMetaObjectBase::addOwningClassLoader(class_loader::ClassLoader*)'class_loader::class_loader_private::getCurrentlyLoadingLibraryName()'
class_loader::class_loader_private::AbstractMetaObjectBase::setAssociatedLibraryPath(std::string)' undefined reference toclass_loader::class_loader_private::getPluginBaseToFactoryMapMapMutex()' undefined reference to
class_loader::class_loader_private::getPluginBaseToFactoryMapMapMutex()'CMakeFiles/Project_node.dir/src/Gui/gui.cpp.o: In function
std::map<std::string, class_loader::class_loader_private::AbstractMetaObjectBase*, std::less<std::string>, std::allocator<std::pair<std::string const, class_loader::class_loader_private::AbstractMetaObjectBase*> > >& class_loader::class_loader_private::getFactoryMapForBaseClass<rqt_gui_cpp::Plugin>()': /opt/ros/indigo/include/class_loader/class_loader_core.h:124: undefined reference to
class_loader::class_loader_private::getFactoryMapForBaseClass(std::string const&)'CMakeFiles/Project_node.dir/src/Gui/gui.cpp.o: In function
class_loader::class_loader_private::AbstractMetaObject<rqt_gui_cpp::Plugin>::AbstractMetaObject(std::string const&, std::string const&)': /opt/ros/indigo/include/class_loader/meta_object.h:150: undefined reference to
class_loader::class_loader_private::AbstractMetaObjectBase::AbstractMetaObjectBase(std::string const&, std::string const&)' /opt/ros/indigo/include/class_loader/meta_object.h:150: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::~AbstractMetaObjectBase()'CMakeFiles/Project_node.dir/src/Gui/gui.cpp.o:(.rodata._ZTIN11rqt_gui_cpp6PluginE[_ZTIN11rqt_gui_cpp6PluginE]+0x28): undefined reference to `typeinfo for nodelet::Nodelet'
Unfortunately I cannot resolve the mentioned Functions. Does anyone of you have an idea, how to solve this issue? Thanks a lot in advance!!!
A simplified system setup is given in the following:
My package has the following order:
Catkin/src/Project/
- src/System/
-system.cpp --> Contains int main()
-system.h
- src/Gui/
-gui.cpp
-gui.h
-gui.ui
- CMakeLists.txt
- package.xml
- plugin.xml
with CMakeLists:
cmake_minimum_required(VERSION 2.8)
add_definitions(-std=c++11)
project(Project)
find_package(Boost)
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation rosbag)
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
add_message_files( FILES messages.msg)
generate_messages( DEPENDENCIES std_msgs)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp rospy std_msgs rosbag message_runtime
CATKIN_DEPENDS message_runtime
DEPENDS Boost
)
QT4_WRAP_CPP(MOC_SRC_H src/Gui/gui.h)
QT4_WRAP_UI(MOC_GUI_H src/Gui/gui.ui)
include_directories(include
${CMAKE_CURRENT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS ...