The following is a guide on how to start using QtCreator in order to build projects in ROS Indigo (Ubuntu 14.04) with the new Catkin Tools.
1) Install Qt Creator:
1 | sudo apt-get install qtcreator |
2) Install the new Catkin Tools
1 | sudo apt-get install python-catkin-tools |
3) Create a catkin workspace with catkin init. It will be assumed that the workspace is configured in ~/catkin_ws
3.1) Before adding your project to qtcreator it is recommended to first clean your workspace a build everything using Catkin tools
1 | catkin clean |
2 | catkin build |
4) Start QtCreator from a new terminal with the ROS environment already configured in its .bashrc.
1 | qtcreator |
5) Select the menu File -> “Open File or Project…”, then select ~/catkin_ws/src/YOUR_PACKAGE_NAME/CMakeLists.txt
6) Set the build dir to your catkin workspace location:
~/catkin_ws/build/YOUR_PACKAGE_NAME
7) Press Configure
8) Now in the Menu on the left of QtCreator select Projects -> Build Settings and add the following CMake arguments:
1 | -DCMAKE_INSTALL_PREFIX=~/catkin_ws/ install -DCATKIN_DEVEL_PREFIX=~/catkin_ws/devel |
9) Save all an close QtCreator
10) In a new terminal start Qtcreator again
qtcreator
10) Now your project should be available and ready to navigate and build.
I also add some lines to my CMakeLists.txt file for Qtcreator to detected the proper location of my header files:
1 | ################## |
2 | # FOR QT CREATOR |
3 | ################## |
4 | FILE(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/YOUR_PACKAGE_NAME/*.hpp) |
5 | FILE(GLOB_RECURSE INC_ALL "include/YOUR_PACKAGE_NAME/*.hpp" ) |
6 | FILE(GLOB_RECURSE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp) |