0
$\begingroup$

I am working with a catkin workspace in C++ and when I open it in an IDE, the cmake command gives the following error:

CMake Error at CMakeLists.txt:65 (message): find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.

However, catkin is installed on my machine as "rospack find catkin" gives the path where catkin is saved which is /opt/ros/noetic/share/catkin.

Moreover, the workspace is sourced with the command "source /opt/ros/noetic/setup.bash"

Appreciate any help!

$\endgroup$
2
  • $\begingroup$ Are you using catkin build or catkin_make? What happens if you cd to catkin_ws directory and run that command in the terminal? $\endgroup$
    – Mike973
    Nov 7 at 21:42
  • $\begingroup$ Hi! I am using catkin_make. Running catkin_make in my workspace root works fine. $\endgroup$
    – Emco
    Nov 8 at 11:03

1 Answer 1

0
$\begingroup$

Since catkin_make works fine in the terminal, it means your problem is with how you have configured the IDE. A ros package is not a simple cmake project, and you can not directly invoke the cmake application.

You don't tell us which IDE you are using. If it happens to be Visual Studio, there are already a large number of existing answers on this site, and you should search for one of them.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.