Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run cmake Qt creator error

Tags:

cmake

ros

I am trying to open a ros package in Qt creator but isn't working. Every time I run cmake the following errors occur:

CMake Error at CMakeLists.txt:15 (catkin_package): Unknown CMake command "catkin_package".

CMake Error at CMakeLists.txt:5 (find_package): Could not find module Findcatkin.cmake or a configuration file for package catkin.

Adjust CMAKE_MODULE_PATH to find Findcatkin.cmake or set catkin_DIR to the directory containing a CMake configuration file for catkin. The file will have one of the following names:

catkinConfig.cmake
catkin-config.cmake

I don't know what to do, any suggestion?

like image 884
Marcos Ribeiro Avatar asked May 30 '26 00:05

Marcos Ribeiro


1 Answers

As stated on the ROS wiki page about IDEs, to open a ROS node in QtCreator you have to...

  1. Make sure, that the setup.bash of your catkin workspace is sourced. You can add source ~/path/to/your/ws/devel/setup.bash to your .bashrc, then you don't have to do it manually for every terminal. (This point is not mentioned on the liked wiki page).
  2. Run QtCreator in a terminal (or use the desktop file from the linked wiki page).
  3. Open the CMakeLists.txt of the whole workspace, not the one of a single package (otherwise compiling within QtCreator will not work properly)
    Note: The CMakeLists.txt of the workspace is only a link to a file somewhere in /opt/ros. This will cause problems for QtCreator, therefore remove the link and copy the file instead (The exact location of the file that has to be copied can be displayed with ls -l CMakeLists.txt).
like image 131
luator Avatar answered Jun 01 '26 19:06

luator