I really like Microsoft's Visual Studio Code editor and I wonder how to configure it to compile and run C code.
1 Answer
You can use C/C++ for Visual Studio Code as it provides code editing, navigation, and debugging support for C and C++ code.
Unless you are sure that you already have a compiler installed, make sure to install a C/C++ compiler and debugger and check the documentation for more instructions!
Popular C++ compilers are:
- GCC on Linux
- Mingw-w64 on Windows
- Microsoft C++ compiler on Windows
- Clang for XCode on macOS
To run your code, and unless you want to go through the hassle of manual configuration, you can use Code Runner
To run code:
- use shortcut Ctrl+Alt+N
- or press F1 and then select/type Run Code,
- or right click the Text Editor and then click Run Code in editor context menu
- or click Run Code button in editor title menu
- or click Run Code button in context menu of file explorer
To stop the running code:
- use shortcut Ctrl+Alt+M
- or press F1 and then select/type Stop Code Run
- or right click the Output Channel and then click Stop Code Run in context menu
You will also find more detailed instructions through the referenced links!