Site icon FahmidasClassroom

How to setup Visual Code Studio Editor for C/C++

Vsc

If you want to learn C/C++ using Visual Studio Code (VSC) then you have to install necessary extension and setup some configuration in VSC to run C/C++ code using VSC. You have to do the following steps to use VSC for executing C/C++ code.

Steps:

1. Run the following command to install Visual Studio Code on Ubuntu.

$sudo snap install --classic code

2. Open VSC

3. Install the required C/C++ extension.

4. The configuration part of launch.json file will be looked like the following content.


"configurations": [
{


	"name": "(gdb) Launch",
	"type": "cppdbg",
	"request": "launch",
	"program": "${workspaceFolder}/${fileBasenameNoExtension}",
	"args": [],
	"stopAtEntry": false,
	"cwd": "${workspaceFolder}",
	"environment": [],
	"externalConsole": false,
	MIMode": "gdb",
	"setupCommands": [
	{

			"description": "Enable pretty-printing for gdb",
			"text": "-enable-pretty-printing",
			"ignoreFailures": true
	}

	]

}]

5. Write a simple C++ code and save with .cpp extension on a particular folder.

6. Create the executable file.

7. Run the executable file.
The steps are shown in the following video link.

Exit mobile version