在linux上写代码的使用clion作为开发ide, 代码跳转不到在代码阅读时很麻烦,参考多个博客完成了相关的配置,做一下记录。
主要步骤:
1. 安装Bear
2. 生成compile_command.json
3. 配置build/run 配置
1. 安装Bear, 因为编译服务器在内网上,所以使用了Bear-2.4.4进行源码安装(https://github.com/rizsotto/Bear/archive/refs/tags/2.4.4.tar.gz),避免后续版本要下载安装很多第三方源码
Bear 源码安装步骤
安装 lit:
pip3 install lit
源码编译安装:
cmake -Dbash-completion_DIR=/work/king/work/Python3/bin -DCMAKE_INSTALL_PREFIX=/work/king/bin/ ./
make all
make check
make install
2. 生成 compile_commands.json
# 在代码