vscode开发,生成compile_commands.json
bear插件报错
ld.so: object '/usr/${LIB}/bear/libear.so' from LD_PRELOAD
bear -h
usage: bear [-h] [--version] [--verbose] [--cdb <file>] [--use-cc <path>]
[--use-c++ <path>] [--append] [--libear LIBEAR]
...
positional arguments:
build Command to run.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--verbose, -v Enable verbose output from 'bear'. A second, third and
fourth flags increases verbosity. (default: 0)
--cdb <file>, -o <file>
The JSON compilation database. (default:
compile_commands.json)
--use-cc <path> Hint 'bear' to classify the given program name as C
compiler. (default: cc)
--use-c++ <path> Hint 'bear' to classify the given program name as C++
compiler. (default: c++)
advanced options:
--append, -a Extend existing compilation database with new entries.
Duplicate entries are detected and not present in the
final output. The output is not continuously updated,
it's done when the build command finished. (default:
False)
--libear LIBEAR, -l LIBEAR
specify libear file location. (default:
/usr/${LIB}/bear/libear.so)
解决方式
find一下
find /usr/ -name "*bear*"
找到之后指导libbear路径
bear -l /usr/lib/x86_64-linux-gnu/bear/libear.so make -j4
这篇博客主要介绍了在Visual Studio Code(VSCode)开发环境中,遇到bear插件在生成compile_commands.json文件时出现的libear.so错误。错误信息显示找不到指定路径的libear.so库。为了解决这个问题,博主建议通过运行`find /usr/ -name *bear*`命令来查找libear.so的实际位置。找到后,使用正确的路径更新bear命令,例如`bear -l/usr/lib/x86_64-linux-gnu/bear/libear.so make -j4`,从而成功生成compile_commands.json。

1341

被折叠的 条评论
为什么被折叠?



