It does not seem to find the catkin package in your environment variable.
How did you start CLion?
You should start it from a terminal which has all ROS setup bash scripts loaded. This ensures that all your environment variables are set correctly.
For me CLion works out of the box, when I start it in a terminal and I select a CMakelist for the project. I can build, run and debug without any extra configuration hassle.
Originally posted by daenny with karma: 376 on 2015-06-03
This answer was ACCEPTED on the original site
Post score: 7
Original comments
Comment by alextoind on 2015-06-04:
Thank you very much, I didn't think about launching from terminal. It works like a charm now! Also, as pointed out by @gvdhoorn, in wiki.ros.org/IDEs there is the explaination for JetBrains PyCharm IDE which I haven't noticed while searching for 'CLion'.
Comment by gvdhoorn on 2015-06-04:
Might be nice to update the IDEs page to include a reference to your particular one. Would save future users some trouble.
Comment by mahi on 2015-06-08:
Following http://wiki.ros.org/IDEs I edited clion *.desktop file as following so that I don't have to start it from command line every time.
Exec=bash -i -c "/bin/clion.sh" %f
Comment by bezcoder on 2015-06-26:
As suggested, by launching CLion from the terminal, that error doesn't come up anymore. Anyhow the build process doesn't work correctly as it outputs in some CLion system folder. Even if the catkin-generated CMakeCache looks fine, CLion uses a different BINARY_DIR for the project.
Comment by alextoind on 2015-06-27:
It should be fine to source the proper setup.bash
. For example if you are on linux try with: source ~/.clion10/system/cmake/generated/<something>/<something>/Debug/devel/setup.bash
Comment by bezcoder on 2015-06-29:
That way the building works in CLion but breaks catkin_make, so I don't consider that as a solution. CLion should just use the makefile in the appropriate directory (ros/build/$projectName) but it seems that it is failing at that.
Comment by gcc05 on 2015-11-26:
I agree with @bezcoder that there should be a way to make CLion generate the files in the catkin ws folders. Has anyone advanced with that? Or if there is any way to use the debugger with the catkin_make generated binaries?
Comment by alextoind on 2015-11-26:
@grar05 actually you can use the debugger with binaries generated through build <something>
from CLion, even if they are not those in the catkin workspace.
Comment by gcc05 on 2015-11-27:
Yes, I've been able to do that in some packages, but I have now a package that aborts when debugged from CLion (but not with the gdb command in the catkin_make binary). Also that I'd rather have the generated files in the workspace than compiling it twice, so debugging the catkin_made pkg would do.
Comment by Reuben John on 2016-11-07:
A ROS plugin for CLion requires one final Clion issue to be fixed. Voting for the fix will help speed things up!
Comment by alextoind on 2016-12-04:
Thanks for the info! Actually with CLion 2016.3 it is now possible to set the cmake build
directory, but I have not found how to separate the devel
directory which is natively put inside the build
one.