- C++ 20
- macOS Montery
- Visual Studio Code
- Compiler: Clang++
Step: Edit .vscode/c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/Library/Developer/**"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/**"
],
"compilerPath": "/Library/Developer/CommandLineTools/usr/bin/clang++",
"cStandard": "c18",
"cppStandard": "c++20",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
Step: Edit .vscode/tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++20",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
]
}
Step: Edit .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "lldb launch",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"preLaunchTask": "C/C++: clang++ build active file"
}
]
}
Step: Add file main.cpp
#include <iostream>
using namespace std;
int main(){
auto result = (10 <=> 20) > 0;
cout << result << endl;
}
Press F5
to run, or click Run
> Start Debugging
0