Skip to content

Latest commit

 

History

History
139 lines (69 loc) · 4.43 KB

README.md

File metadata and controls

139 lines (69 loc) · 4.43 KB

How to Run the Projects

NOTE: We will be using Visual Studio Code. Click here to download Visual Studio Code.


C/C++ for Visual Studio Code

C/C++ support for Visual Studio Code is provided by a Microsoft C/C++ extension to enable cross-platform C and C++ development on Windows, Linux, and macOS.

cpp-extension

Install the extension

  • Open VS Code.
  • Select the Extensions view icon on the Activity bar or use the keyboard shortcut (Ctrl+Shift+X).
  • Search for C++.
  • Select Install.
  • After you install the extension, also search for Code Runner extension and install it.

search-cpp-extension

Install a compiler

C++ is a compiled language meaning your program's source code must be translated (compiled) before it can be run on your computer.

The C/C++ extension does not include a C++ compiler or debugger. You will need to install these tools or use those already installed on your computer.

Most Linux distributions have the GNU Compiler Collection (GCC) installed and macOS users can get the Clang tools with Xcode.

Check if you have a compiler installed

  • Checking for the GCC compiler g++:

    g++ --version

  • Checking for the Clang compiler clang:

    clang --version

If you don't have a compiler installed, we will describe how to install the Minimalist GNU for Windows (MinGW) C++ tools (compiler and debugger). MinGW is a popular, free toolset for Windows.

If you are running VS Code on another platform, you can read the vlang/LLVM Compiler and Debugger (For-macOS) , which cover C++ configurations for Linux and macOS.

Install MinGW-x64 (For Windows)

  • Follow the Installation instructions on the MSYS2 website to install Mingw-w64.
  • Make sure to run each required Start menu and pacman command.
  • Add the MinGW compiler to your path: follow the video below to do that

Video Explanation on how to Run the whole process

https://www.youtube.com/watch?v=7jil6-QRsH0


Check your MinGW installation

To check that your Mingw-w64 tools are correctly installed and available, open a new Command Prompt and type:

gcc --version

g++ --version

gdb --version

If you don't see the expected output or g++ or gdb is not a recognized command, make sure your PATH entry matches the Mingw-w64 binary location where the compiler tools are located.

NOTE

Follow the video to know How to Install MinGW (MSYS2) and Run C, C++ program in VS Code for Windows




PART FOR macOS


Install Clang/LLVM compiler and debugger (For macOS)


In this tutorial, you will learn to configure Visual Studio Code on macOS to use the Clang/LLVM compiler and debugger.

Prerequisites

To successfully complete this tutorial, you must do the following:

  • Install Visual Studio Code on macOS.

  • Install the C++ extension for VS Code. You can install the C/C++ extension by searching for c++ in the Extensions view (Ctrl+Shift+X).

cpp-extension

Ensure Clang is installed

  • Clang may already be installed on your Mac. To verify that it is, open a macOS Terminal window and enter the following command:

clang --version

  • If Clang isn't installed, enter the following command to install the command line developer tools:

xcode-select --install

Video Explanation on how to Run the whole process

https://www.youtube.com/watch?v=f0vVV4NPmjQ


How to Contribute: 🔝

  • Just fork the project and clone it into your machine
  • Then make your contribution and upload it to your fork repository
  • Then click on pull request

Donates to Support

NOTE

If you face any issues kindly let us know