ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Qt supports cmake and in the latest version of Qt, it is highly recommended to stick with cmake and discard qmake since cmake will be the future for Qt. This is good news since ROS also uses cmake. The c++ ROS libraries are just normal c++ libraries which means you need only to add them in Qt CMakeLists.txt. Follow the steps shown below

1- Start Qt Creator from termina (i.e. this is crucial) 
2- Add the following in Qt CMakeLists.txt
   find_package(roscpp REQUIRED)
   find_package(std_msgs REQUIRED)    # if you are using std_msgs of course.
   include_directories(include ${roscpp_INCLUDE_DIRS})
   include_directories(include ${std_msgs_INCLUDE_DIRS})      
   target_link_libraries( ${roscpp_LIBRARIES} ${std_msgs_LIBRARIES}

Now include ros header files and compile the project. That's it.