vscode插件:clangd

关闭c++的代码补全等功能

"C_Cpp.intelliSenseEngine": "Disabled"

生成compile_commands.json文件

基于cmake

// CMakeLists.txt
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

基于make

pip install compiledb

compiledb -n make -C build

或者
compiledb make -C build

基于bear

bear – make

brew install icu4c

export PKG_CONFIG_PATH=“/usr/local/opt/icu4c/lib/pkgconfig”