Course Introduction to Programming

Installing the IDE

Course's Page 5 min Text by
User Image
Tiago Barros Pires

In this class, we will install Visual Studio Code, a modern, lightweight, and highly extensible code editor. It allows you to configure exactly the features you need, turning it into a powerful development tool for C and other languages.

โš ๏ธ This class is special because we are updating the course! Previously, the CodeBlocks program was used. You can check the instructions for installing it in the video and at the end of the class.

Installing Visual Studio Code (VSCode)

  • All operating systems:
    1. Go to the official VSCode website and download the appropriate version for your system.

      Figure 1 :Download VSCode

    2. Double-click the downloaded file to start the installation.

    3. Check the "Open with Code" options to facilitate opening VSCode directly in the working folder.

      Figure 2 :Options during the VSCode installation

After installation, open VSCode. Its layout should look like the image below.

Figure 3 :Initial view of VSCode after installation

Installing the C/C++ Extension

In VSCode, we can install extensions that enhance its functionalities, allowing you to customize the editor according to your specific needs. The C/C++ extension is particularly important as it provides fundamental features for C development. To install it, follow the steps below:

  1. Press Ctrl+Shift+X to open the extensions tab
  2. Search for "C/C++" (official Microsoft extension)
  3. Click "Install":

Figure 4 : Extension view in the VSCode Marketplace

Installing MinGW-w64

MinGW-w64 is a compilation tool that we will use to compile our C programs. To install it, we will use MSYS2, a tool that facilitates the installation and updating of development tools. To do this:

  1. Download the installer via this link.

  2. Run the installer and follow the installation wizard steps. It is sufficient to leave all options as they are (just click next).

  3. When finished, make sure the "Run MSYS2 now" box is checked and select "Finish":

    Figure 5

  4. This will open an MSYS2 terminal window for you. In it, paste the command below (right-click and "Paste"):

    pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
    

    Figure 6

  5. Accept the default number of packages in the toolchain group by pressing Enter:

Figure 7

  1. Press "Y" to proceed with the installation:

Figure 8

  1. After the process is complete, we need to add the program to the Windows PATH:

    • Open the Command Prompt (type "cmd" in the Windows search bar) and execute the following command:
    setx PATH "%PATH%;C:\msys64\ucrt64\bin"
    

Check Installation

To check the installation, we need to close the Command Prompt and open it again to capture the changes we made to the PATH. Then, execute:

gcc --version

It should display something like:

Figure 9

If there is any error, contact us via Discord for assistance!

Installing Code Runner

To finish, install the Code Runner extension, which simplifies code execution. Follow these steps:

  1. Press Ctrl+Shift+X to open the extensions tab.
  2. Search for "Code Runner" (the official Microsoft extension).
  3. Click "Install":

Figure 10 : Extension view in the VSCode Marketplace

After installation, access the settings:

  1. Press Ctrl+, (Ctrl + comma).
  2. Search for "code runner run in terminal".
  3. Check the corresponding option:

Figure 11 : View of the VSCode settings


Installing CodeBlocks

This section belongs to the old version of the course. If you do not want to use VSCode, follow the steps below.

What is CodeBlocks?

CodeBlocks is an IDE for programming in some programming languages, including the C language. IDEs are programs that facilitate the coding of programs, and they come with tools that make programming easier, and they already come with the compiler included.

Installing CodeBlocks.

To download CodeBlocks, go to the official CodeBlocks website. You will be redirected to a page like this:

Figure 12

Always click on the option with "mingw-setup", in this tutorial "codeblocks-20.03mingw-setup.exe".

Figure 13

Press "sourceforge.net" to start the download. Once the download is complete, click on the downloaded file to perform the installation.

Figure 14

After you click on the installer, a screen like this will open, press Next to continue.

Figure 15

On the licensing screen, press I Agree to accept and continue.

Figure 16

On the Choose Components screen, click Next.

Figure 17

On the Choose, Install Location screen, click Install to proceed with the installation. If you want to install CodeBlocks in a specific folder, different from the default, modify the destination folder field before pressing Install.

Figure 18

After the installation, a message like this will appear, press yes to start CodeBlocks.

Figure 19

Now verify that the compiler was detected as: Default compiler: GNU GCC Compiler and click Ok

Figure 20

Choose the option "Yes, associate Code :: Blocks with C/C++ file types" to associate C and C++ files with CodeBlocks and press Ok

Now we are ready to start coding programs in C.