ROS: Build and Debug with Qt Creator

Jan 19, 2016



Please note that there is now a Qt Creator plugin for ROS development ROS Qt Creator Plug-in wiki. Please use this plugin instead, rather than using the method in the following sections.

Note that the debugger may be not permitted to attached to your ROS nodes. In such cases, try revising the /etc/sysctl.d/10-ptrace.conf file by changing

kernel.yama.ptrace_scope = 1


kernel.yama.ptrace_scope = 0

Reference: stack overflow

updated at 2017-05-11


Ubuntu 14.04, ROS Indigo (Newer versions should be okay). Qt Creator is an open source IDE for C++ project development, which not only supports its native C/C++ project management, but also provides CMake project building and debugging by just openning the main CMakeLists file.

Installing Qt Creator

In terminal:

sudo apt-get install qtcreator

To launch Qt Creator, in terminal:


Note: Qt Creator should be launched in the terminal, rather than clicking the software icon. That’s because terminal will source .bashrc, which contains environmental setup of ROS. Also, according to the ROS Wiki, you can use the following desktop file qtcreator.desktop and use it in your launcher (remember to use chmod to make executable):

[Desktop Entry]
Exec=bash -i -c qtcreator %F
Name=Qt Creator
GenericName=Integrated Development Environment

Configuring Qt Creator for rosbuild

rosbuild is an old-fashioned building system of ROS. Yet, there are still some packages built with it, for example ORB-SLAM. We use ORB-SLAM as an example.


  1. Clone the source code files from ORB-SLAM’s main page.

  2. Append ORB-SLAM directory to the ROS_PACKAGE_PATH, according to the instructions in the main page.

  3. Build the Thirdparty libraries according to the instructions in the main page.

To open the package:

  1. Launch Qt Creator through terminal.

  2. Type Ctrl + O and select CMakeLists.txt in the root folder of ORB-SLAM to open.

  3. Qt Creator will automatically parse the source files of the package. You can use the keyboard shortcuts to navigate through the code implementation (like F2 to go to a class declaration).

To build the package:

  1. In the project configuration, set the build directory and assign CMake argument as .. -DROS_BUILD_TYPE=Release (or .. -DROS_BUILD_TYPE=Debug if you want to debug the program), as figure below.


  2. Right click on the project directory, and Run CMake, as Figure below.


  3. Click Build either in right-click menu or on the hammer icon in the left-bottom corner. The action of Build is equivalent to command make in terminal.

Configuring Qt Creator for catkin_make

catkin_make is a new and more recommended built-in tool for ROS project management. As we know, individual packages files are put in the /src directory of a workspace directory. The key step in using Qt Creator to configure catkin workspace is to open the CMakeLists.txt file in the /src root directory. Here the tricky thing is, the initialized workspace contains a symlink of CMakeLists.txt which links to a file in the installed directory of ROS. In order to avoid driving QtCreator mad, we must replace the symlink’ed CMakeLists.txt in catkin_ws/src with a physical copy of the actual stuff:

cd ~/catkin_ws/src
ls -l  # Take note of the actual symlink target
sed -i '' CMakeLists.txt
ls -l # The symlink should have gone away

After openning the CMakeLists file, configure the build dir to be catkin_ws/build/ , right click on the project directory and run CMake (like in rosbuild part), and you can see all your source files being parsed and listed in the project management panel. In the building settings, declare the CMake arguments as


And now we are ready to go. Happy coding.


  1. IDEs - ROS Wiki

  2. ROS: How to develop catkin packages from an IDE

Tags: ROSC/C++

Comment by Github Issues

Chat in Gitter/fan-farm

License (CC) BY-NC-SA | Subscribe RSS | Email