Today we will be talking about the basics of setting up your Code::Blocks environment up and running. For those that do no know what is Code::Blocks, it is an Integrated Development Environment that allows users to code C, C++, and Fortran, programming languages in it. Let us now dive into it.
Download & Installation
Firstly, download Code::Blocks from this website here. Next, choose the download option that has “mingw-setup” (see Figure 1). Downloading this will include the gcc compiler which is included in MinGW. You may choose FossHUB or Sourceforge.net. I chose Sourceforge.net.
Figure 1: Download page of Code::Blocks
Once downloaded, run the installer and keep clicking next till the installation is finished. You do not have to choose any other options. Use the default chosen options in the installer.
Run the Code::Blocks application. When reaching the main page of the IDE, this notification may pop up (see Figure 2a). This prompts you that Code::Blocks cannot find the gcc compiler. For such scenario, this is because the path to gcc compiler in the settings is incorrect.
Figure 2a: Compiler cannot be found notification
To resolve this issue, go to settings > Compiler… (see Figure 2b).
Figure 2b: Compiler settings navigation
Once you are in Global compiler settings, navigate to Toolchain executables. Click on the “…” texted button (see Figure 2c) to select the location of our gcc compiler.
Figure 2c: Select compiler location
The location of the gcc compiler should be in this folder:
If it isn’t, it might be in this location:
C:\Program Files (x86)\CodeBlocks\MinGW\bin
Else, look for the bin folder which is in MinGW which should be in the CodeBlocks directory where you have installed CodeBlocks at.
Select that location in the folder and click the ok button in the Global compiler settings. If it is successful, there will not be a notification popup with regards to unable to find the compiler (see Figure 2a). You can now create a project or an empty file and start coding, build, and run.
I hope today’s article will be useful to you. Feel free to leave any comments below. You may also send me some tips if you like my work and want to see more of such content. Funds will mostly be used for my boba milk tea addiction. The link is here. 🙂