Add Ros library to qt creator

asked 2015-04-16 12:05:29 -0500

anil gravatar image

Hi everybody

I want to use qt gui with ros. I follow this steps.

Create qt and ros project different workspace.I organized Cmakelist.txt for creating .so file and add this lines

cmake_minimum_required(VERSION 2.4.6)
# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)


 #set the default path for built executables to the "bin" directory
#set the default path for built libraries to the "lib" directory

#uncomment if you have defined messages
#uncomment if you have defined services

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_link_boost(${PROJECT_NAME} thread)

rosbuild_add_executable(run1 src/test.cpp)
add_library(base src/Base.cpp)
target_link_libraries(run1  base )

Then file was created. I add file to Qt project by using external library ,and ı preapered the code. when ı try to run the qt project ı have ros undifed references errors.

    /home/anil/qt_workspace/bitirme_arayuz/../../catkin_ws/src/calisma/lib// undefined reference to`Node::Node(float, float, double, int, int, int, int)'
    /home/anil/qt_workspace/bitirme_arayuz/../../catkin_ws/src/calisma/lib// undefined reference to`ros::spinOnce()'
    /home/anil/qt_workspace/bitirme_arayuz/../../catkin_ws/src/calisma/lib// undefined reference to`ros::Rate::Rate(double)'
     /home/anil/qt_workspace/bitirme_arayuz/../../catkin_ws/src/calisma/lib// undefined reference to`ros::init(int&, char**, std::string const&, unsigned int)'
    /home/anil/qt_workspace/bitirme_arayuz/../../catkin_ws/src/calisma/lib// undefined reference to`ros::Rate::sleep()'
    /home/anil/qt_workspace/bitirme_arayuz/../../catkin_ws/src/calisma/lib// undefined reference to `ros::ok()'collect2: error: ld returned 1 exit status
      make: *** [bitirme_arayuz] Error 118:14:16: The process "/usr/bin/make" exited with code 2. Error while building/deploying project bitirme_arayuz (kit: Desktop Qt 5.4.1 GCC 64bit) When executing step "Make" 18:14:16: Elapsed time: 00:06.
edit retag flag offensive close merge delete



Hi, i not complete get your exact question, do u want to use qtcreator to build ros? and then add your Base as a Lib to use it in other ROS-Packages? What Version of ROS you are using? seems not to be catkin already or?

ReneGaertner gravatar image ReneGaertner  ( 2015-04-17 03:54:49 -0500 )edit

Firstly thank for interest. I am using ROS indigo and want to use qt creator gui to build ROS project. And Base.cpp as a Lib ( name) to use under qt gui. Briefly ı have some parameters in ROS project then then I want to assign parameters in qt gui (with the set and get functions in Base)

anil gravatar image anil  ( 2015-04-17 16:09:51 -0500 )edit

@anil did you ever fix this? I think I'm trying to do something very similar

JaneSheard gravatar image JaneSheard  ( 2016-04-21 05:17:12 -0500 )edit