MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Visual Studio Freedom

without comments

Some of my students want to learn to write C++ on a Windows OS. At some point, you simply surrender to the fact that many people prefer the Windows OS as a starting point. Traditionally, I’d recommend the Microsoft Visual Studio as their learning vehicle because it’s free to our students because of our relationship with Microsoft. It’s not free to graduates. When a graduate contacts me I recommend Code::Blocks. Just recently, one ask for more than a recommendation. He wanted instructions. These are the instructions.

Download and Install Code::Blocks

Here are the instructions to install and download Code::Blocks 13.12.

CodeBlocks_01

  1. You can download Download and Install Code::Blocks from the web site. Then, you can install Code::Blocks from download folder.

CodeBlocks_02

  1. You launch the codeblocks-12.12mingw-setup.exe file from the download folder.

CodeBlocks_03

  1. This is the first screen of the Code::Blocks wizard. Click the Next button to continue.

CodeBlocks_04

  1. This is the license agreement. Click the I Agree button to continue.

CodeBlocks_05

  1. This screen shows the components to install. The default has all of them checked. I recommend you keep the default. Click the Next button to continue.

CodeBlocks_06

  1. This screen lets you accept the default install location or to chose another install location. I recommend you keep the default install location. Click the Install button to continue.

CodeBlocks_07

  1. This screen shows you the extracting and deployment of files. Click the Next button to continue.

CodeBlocks_08

  1. This indicates that you’ve installed the product, and it now prompts you to run Code::Blocks programscreen shows you the extracting and deployment of files. Click the Yes button to continue.

CodeBlocks_09

  1. This indicates that the installer detects a GNU GCC Compiler. Click the OK button to continue.

CodeBlocks_10

  1. This acknowledges the completion of the installation. Click the OK button to continue.

CodeBlocks_9a

  1. This dialog tells you the installation has completed. Click the Next button to continue.

CodeBlocks_9b

  1. This dialog completes the installation. Click the Finish button to end the installation.

Configure Code::Blocks

CodeBlocks_11

  1. This is the main menu of Code::Blocks application. You need to click the Create a new project link to continue.

CodeBlocks_12

  1. You should choose a Console application for this example. Double click the Console application icon to continue.

CodeBlocks_13

  1. This dialog launches the Console page. Check the Skip this page next time and then click the Next button to continue.

CodeBlocks_14

  1. This dialog lets you choose whether you want to write a C and C++ program. Click the Next button to continue.

CodeBlocks_15

  1. This dialog lets you choose whether you want to write a C and C++ program. Click the Next button to continue.

CodeBlocks_16

  1. This dialog lets you choose the compiler, debug, and release configurations. Click the Finish button to continue.

Create and run a program in Code::Blocks

CodeBlocks_17

  1. This dialog gives you an empty project. Click the Sources item in the list of the Project tab.

CodeBlocks_18

  1. This dialog adds a main.cpp to the list of the Management console. Click the main.cpp item in the list of the Project tab.

CodeBlocks_19

  1. After clicking the main.cpp item in the Project list, the Code::Blocks IDE generates the content of the main.cpp file. Click the Green Arrow to run (compile and execute) the main.cpp file. The endl is a defined in std, and like a \n line terminator.

CodeBlocks_20

  1. A new file hasn’t been compiled (or built), which means you get the following dialog. It wants to know if you want to build the program. Click the Yes button to build the program.

CodeBlocks_21

  1. After making the file, the Build Log tells you whether the code compiles or not. Click the Run green arrow to run the program.

CodeBlocks_22

  1. After running a Console application, you’ll see the output of your program in a console window like the following. You can close it by clicking the console window’s close button.

CodeBlocks_23

  1. After executing the compiled file, the Build Log tells you whether the program compiles successfully or not.

As always, I hope this helps those who read it. Good luck learning to write C/C++ programs.

Written by maclochlainn

July 5th, 2014 at 1:48 am

Posted in C/C++ Programming

Tagged with