MacOS VSCode 调用boost 库
下载 boost库
使用 homwbrew
下载。
brew install boost
修改c_cpp_properties.json
- 搜索boost库的安装位置,从homebrew安装,文件路径为
/opt/homebrew/Cellar/boost/1.79.0_1
. - command + shift + p,搜索properties,打开
c_cpp_properties.json
修改includepath
修改task.json
仅仅修改c_cpp_properties.json仍然会报错找不到库,还需要修改task.json
.
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-I/opt/homebrew/Cellar/boost/1.79.0_1/include"
],
经过以上三步,可以正常运行cpp文件。