Using C++ in VS Code
1. Terminal > Configure Default Build Task to create tasks.json.
2. Run > Add Configuration… and then choose C++ (GDB/LLDB) to create launch.json.
3. C/C++: Edit Configurations (UI) from the Command Palette Ctrl+Shift+P to create c_cpp_properties.json.
Build
Press Ctrl+Shift+B or from the Terminal main menu choose Run Build Task.
Start a debugging session
1. Press F5 or from the main menu choose Run > Start Debugging
2. Press Ctrl+F5 or from the main menu choose Run > without Debugging
Using CMake Tools
1. Open the Command Palette Ctrl+Shift+P and run the CMake: Quick Start command to create CMakeLists.txt.
2. Open the Command Palette Ctrl+Shift+P and run CMake: Select a Kit to select the compiler you want to use.
3. Open the Command Palette Ctrl+Shift+P run the CMake: Select Variant command to select a variant.
4. Open the Command Palette Ctrl+Shift+P and run the CMake: Configure command to configure your project.
Build
Press F7, or open the Command Palette Ctrl+Shift+P and run the CMake: Build command, or select the Build button from the Status bar.
Start a debugging session
1. Press Ctrl+F5 or open the Command Palette Ctrl+Shift+P and run CMake: Debug.
2. Press Shift+F5 or open the Command Palette Ctrl+Shift+P and run CMake: Run without Debug.
ref:
• Using C++ on Linux in VS Code
• Get started with CMake Tools on Linux
#c++ #linux #vscode #cmake