CMake c++ vscode macOS

1、下载安装cmake 官网下载 命令行安装
ref https://blog.csdn.net/qq_34980490/article/details/110389433
2、vscode 安装插件 c/c++, c++ Intellisense ,cmake ,cmake tools
ref https://www.jianshu.com/p/7b84a4dc1ad0
3、VScode 设置cmake 路径
进入首选项 -> 设置 添加CMake 路径 “cmake.cmakePath”: “自己CMake的路径” 我的是:
“cmake.cmakePath”: “/Applications/CMake.app/Contents/bin/cmake”
ref https://blog.csdn.net/qq_34980490/article/details/110389433
4、创建调试代码 hello world
ref https://www.jianshu.com/p/7b84a4dc1ad0
5、进行vscode 设置
Command + Shift + P,输入CMake:Configure,回车。
ref https://www.jianshu.com/p/7b84a4dc1ad0
5.1 bug [cmake] Error opening terminal: unknown.
解决: 使用 vim ~/.bash_profile 设置环境变量 export TERM=xterm 然后重启vscode
ref https://bbs.archlinux.org/viewtopic.php?id=94780
ref https://www.jianshu.com/p/8e51bc9cebfa
6 设置tasks.json launch.json
ref https://blog.csdn.net/wanzew/article/details/83097457
6.1 problem

image.png

solve change MIMode from gdb to lldb (or install other gdb and set MIDebuggerPath as warning say)。
7 good job!


image.png

你可能感兴趣的:(CMake c++ vscode macOS)