← 返回命令列表

Linux command

bear 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate

bear -- make

Append

bear --append -- make clean all

Custom output

bear --output [compile_commands.json] -- ninja

说明

bear (Build EAR) generates a compilation database (compile_commands.json) by intercepting compiler calls during a build. This database enables tools like clangd, clang-tidy, and IDEs to understand the project structure without custom configuration. The tool works with any build system by recording actual compiler invocations.

参数

--append, -a
Append to existing compilation database
--output _file_, -o _file_
Output file (default: compile_commands.json)
--force-preload
Force library preload method
--force-wrapper
Force compiler wrapper method
--verbose, -v
Verbose output

FAQ

What is the bear command used for?

bear (Build EAR) generates a compilation database (compile_commands.json) by intercepting compiler calls during a build. This database enables tools like clangd, clang-tidy, and IDEs to understand the project structure without custom configuration. The tool works with any build system by recording actual compiler invocations.

How do I run a basic bear example?

Run `bear -- make` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --append, -a do in bear?

Append to existing compilation database