- 安装VSCode,点击下载链接,下载Mac版本的vscode。
- 安装“C++ extension for VS Code”,在扩展 (⇧⌘X)中搜索c++,并安装
- 确保CLANG安装成功。在mac的终端下输入
clang --version
,如果安装成功会打印相关信息,未成功输入“xcode-select --install”安装CLANG。 - 安装从命令行打开VSCode的命令。
打开Command Palette (Cmd+Shift+P),输入’shell command’,之后选择安装,之后退出Mac终端再进入终端,输入.code 就可以在该文件夹下打开VSCode了。原文如下
Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type ‘shell command’ to find the Shell Command: Install ‘code’ command in PATH
command. macOS shell commands
Restart the terminal for the new $PATH value to take effect. You’ll be
able to type ‘code .’ in any folder to start editing files in that
folder.
- 编写Hello World,直接参考https://code.visualstudio.com/docs/languages/cpp
本文参考:
- https://code.visualstudio.com/docs/cpp/config-clang-mac
- https://code.visualstudio.com/docs/languages/cpp
- https://code.visualstudio.com/docs/setup/mac