## Config VS Code for C++
**Step 1: Install Extensions**
- C/C++
- C/C++ Extension Pack
- Code Runner
**Step 2: Configure the "Code Runner" Extension**
- Open Visual Studio Code and go to **File** > **Preference**s > **Settings**.
- In the settings, search for "Run Code Configuration."
- Find the "Code-runner: Executor Map" setting and click on **"Edit in settings.json.**
**Step 3: Update the Configuration**
- Remove the existing "cpp" configuration if it's present to avoid duplications.
- Copy and paste the following code:
```json
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && start cmd \"/K .\\$fileNameWithoutExt\"",
```
paste the code under:
`{`
`"code-runner.executorMap": {`
- Save the settings.
**Step 4: Run Your C++ Code**

**Step 5: If you want to custom hotkey like Sublime Text**
- Go to the menu bar and select "File" > "Preferences" > "Keyboard Shortcuts"
- Change the current `ctrl + B` shortcut to another shortcut (does not conflict with existing keyboard shortcuts)
- Change "Run Code" shortcut to `ctrl + B`
---
#### Reference :
- [reddit](https://www.reddit.com/r/vscode/comments/17qfkx6/can_i_run_c_code_in_visual_studio_code_but_the/)