Clion调试ROS包

1. 安装

   从官网下载最新版本的Clion

  https://www.jetbrains.com/clion/

  并解压到指定的目录,例如:

  /home/xkc/software/clion-2017.2.3

      默认Clion可以免费使用30天,学生可以凭借学生证,免费使用的话可以申请一年.

   授权方法:激活时选择License server,填入http://idea.irfen.me/ 点击Active即可。

2.环境变量配置

a.配置环境变量
     打开 .bashrc文件修改内容
     vim ~/.bashrc
     export PATH=/home/xkc/software/clion-2017.2.3/bin:${PATH}

    修改后退出,使修改生效
    source ~/.bashrc

b.启动
    在终端中输入clion.sh 启动

3.导入项目

   在ros下进行断点调试

  1. With your console, go into your ROS workspace and source the respective setup.bash file. for instance: source devel/setup.bash
  2. Go to the src directory of your workspace.
  3. Start CLion from the console from your src directory.   for instance: type the command in the terminator: clion.sh
  4. Close any open projects in CLion and select Import Project from Sources
  5. Select ONLY the src directory in your workspace for the import.
  6. If CLion complains about CMakeList.txt already existing simply click Open Project
  7. CLion will build symbols for several minutes, then you should be ready to go.

   如下图所示:

 

4.调试项目

    在软件IDE的右上角有调试的选项,如下图所示

    Clion会自动的识别可编译的库和执行程序,我们这里选择test可执行文件,只要点击三角箭头和调试虫子,就可以进行相应的调试开发了.使用起来可谓是相当的人性化,难怪要收费了.

    Clion可以轻松的进行断点调试 ,如下图所示:

原文地址:https://www.cnblogs.com/cv-pr/p/7929018.html