- Install VSCode, click theDownload link to download the Mac version of vscode.
- Install "C++ extension for VS Code", search for c++ in the extension (⇧⌘X), and install
- Ensure that CLANG is installed successfully. Enter
clang --version
in the mac terminal. If the installation is successful, relevant information will be printed. If it is not successful, enter "xcode-select --install" to install CLANG. - Install the command to open VSCode from the command line.
Open the Command Palette (Cmd+Shift+P), enter 'shell command', then select installation, then exit the Mac terminal and then enter the terminal, enter .code to open VSCode in the folder . The original text is as follows
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.
- Write Hello World, refer directly tohttps://code.visualstudio.com/docs/languages/cpp
References to this article:
- https://code.visualstudio.com/docs/cpp/config-clang-mac
- https://code.visualstudio.com/docs/languages/cpp
- https://code.visualstudio.com/docs/setup/mac