Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Run C/C++New to Visual Studio Code? Get it now.
Run C/C++

Run C/C++

Abrar Shakhi

|
60 installs
| (0) | Free
Run C/C++/C# files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Run C/C++/C#

how to run?

First open a C, C++ file or C# project

  • use shortcut Ctrl+Alt+C
  • right click the Text Editor and then click Compile and run in editor context menu
  • click Compile and run button in editor title menu

Demo

demo


! this is the code that is executed in the terminal

if (fileExt === '.c') {
    terminal.show();
    terminal.sendText(`cd "${filePath.substring(0, filePath.lastIndexOf("\\"))}";`);
    terminal.sendText(`gcc "${filePath}" -o "${fileName}"; ./"${fileName}";`);
}
else if (fileExt === '.cpp') {
    terminal.show();
    terminal.sendText(`cd "${filePath.substring(0, filePath.lastIndexOf("\\"))}";`);
    terminal.sendText(`g++ "${filePath}" -o "${fileName}"; ./"${fileName}";`);
}
else if (fileExt === '.cs') {
    terminal.show();
    terminal.sendText(`cd "${filePath.substring(0, filePath.lastIndexOf("\\"))}";`);
    terminal.sendText(`dotnet run;`);
}

I made this extention to run my own C/C++/C# file. You can install it too. report bugs/issues here github

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft