Home » E-Books » Educational Software » How to install and run Code blocks C++ IDE. Computer Science Software for class 12.

How to install and run Code blocks C++ IDE. Computer Science Software for class 12.

 

About CodeBlocks
Code::Blocks is a free C++ IDE built to meet the most +demanding needs of its users. It is designed to
be very extensible and fully configurable.

Download Code Blocks

Download CodeBlocks Linux 64 Bit Download CodeBlocks Linux 32 Bit Download CodeBlocks MAC OS Download CodeBlocks Windows OS

 

Features
Highlights:
· Open Source! GPLv3, no hidden costs.
· Cross-platform. Runs on Linux, Mac, Windows (uses wxWidgets).
· Written in C++. No interpreted languages or proprietary libs needed.
· Extensible through plugins
Compiler:
· Multiple compiler support:
o GCC (MingW / GNU GCC)
o MSVC++
o Digital Mars
o Borland C++ 5.5
o Open Watcom
o …and more
· Very fast custom build system (no makefiles needed)
· Support for parallel builds (utilizing your CPU’s extra cores)
Multi-target projects
· Workspaces to combine multiple projects
· Inter-project dependencies inside workspace
· Imports MSVC projects and workspaces (NOTE: assembly code not supported yet)
· Imports Dev-C++ projects

Introduction
Through the aid of a compiler, a program written in a computer language, such as C++, is turned into machine code, which is executed on the computer.The purpose of this manual is to help the student develop the skills to organize program coding and develop sound techniques for finding and isolating errors. Here you will learn how to trace the code step by step, so that it becomes clear where the problem is and why your program does not execute properly. This is called debugging the program. Hand tracing is useful in helping beginners understand where the bugs are and correct the program appropriately. Automatic tools have also been developed to help you trace programs that you have written and will be an important tool as your programs become more complex. This type of tool is called a debugger. A debugger lets you pause a program, while it is in the middle of running, and watch what is going on. Some debuggers work as command-line line debuggers, but newer debuggers have a nice graphical user interface, which is useful in helping you watch variables that you have defined as the program executes. The graphically- based debugger environment is part of what is called the Integrated Development Environment (IDE).

A debugger cannot solve your problems for you. It is merely a tool to assist you when programming.
You should first attempt to read over your code and using paper and pencil analyze the code to get an
understanding of what is going on. Once you have gotten an idea of where in your code you have an error, you can then set the debugger to watch certain variables in your program. Watching your code will show you step by step how your program is being executed. The debugger that you will use is part of an Open Source free IDE called Code::Blocks, which we have found easy to use and is described in these notes. Code::Blocks has a C++ editor and compiler. It will allow you to create and test your programs from one easy to use application. We hope these notes will assist you in making programming more enjoyable and help you develop better programming skills.

You may find additional information regarding Code::Blocks at: http://www.codeblocks.org/
A complete manual for Code::Blocks is available here: http://www.codeblocks.org/user-manual

Installation of Code Blocks

Step 1: Get the Software

In order to install the Code::Blocks IDE as well as the compiler, pick the one from the accompanying CDROM as per the operating system you are using. You will get the installer application in the folder of appropriate OS on the CDROM. Open the folder and proceed with the instructions. In this section, we are covering the installation of Windows based Code Blocks software.

If you are using Mac OS X or Linux, please see Appendix I for installation instructions.

Step 2: Install the Software

Next, open (click on) CodeBlocks install file and the CodeBlocks Setup will begin installing as
follows:

codeblocks 1

Click Next.

codeblocks 2

Select I Agree.

Take the default settings by pressing Next

codeblocks 3

Take the default folder to install CodeBlocks to and then select Install.

Using Code::Blocks
This section explains how to create a console project, which is suitable for basic C++ programs that use the console (keyboard input and text output) for a user interface. The example screenshots in this section are from a Windows installation. Macintosh users may see slightly different screens, but the commands should be identical. For each new program, you’ll need to create a project. A project will contain your source code, generated executables and various configuration files within a single folder.

1. From the Start Here screen, click on Create a new project. You can also start from the main
menu using the command : FileNewProject .

codeblocks 4

2. Select “Console application” and press “Go”.

codeblocks 5

3. Select “C++” as the language you want to use and press “Next”.

codeblocks 6

codeblocks 74. The next screen asks you to name your project and select a location for your project. Be sure you place the project in an easy to find location and give it a meaningful name, so that you can find it again later.
For this example, the project has been created in the directory C:\codeblocks-tutorial, with name first-project.

5. The next screen sets up the compiler and configuration for the project. Select the GNU GCC Compiler and be sure that both the Debug and Release check boxes are selected. Press Finish to create your project.

codeblocks 8

6. This will create a new folder for the project within the location folder you selected. You can verify the
location of the project by navigating to the appropriate directory. For example:

codeblocks 10

When the project is initially created, it will contain two files. The .cbp file is the Code::Blocks project file, which can be used to reopen the project later. The .cpp file is the C++ program file that you will edit to create your program.

7. Expand the tree in the Projects tab to the left of the Code::Blocks window and double click on main.cpp to load the program file into the editor

codeblocks 9

8. Edit the code to create your program. As you are working periodically save your changes (main menu:: FileSave all files . You can also save all files with the short cut CTRL-SHIFT-s , or save a single file with the short cut CTRL-s .

codeblocks 11

9. Build the project to compile your program into an executable. Use the Build menu and select
Build (or press CTRL-F9 ).

codeblocks 12

10. Check for error messages in the lower window. If there are errors, return to step 8 and correct them. If there are no errors, proceed to step 11.

11. Run your program. main menu :: BuildRun (or press CTRL-F10 ).

12. If the program runs as expected, you’re finished. If it does not run as expected, return to step 8 and correct your program.

Capturing Program Execution
This section is specific to Windows installations.

Most assignments will require you to capture a snapshot of the program’s console. Do this at the end of program execution, before closing the console.

1. The console will remain open until you press some key to close it. It should look similar to this:

codeblocks 13

2. Right-click the mouse anywhere in the black console area. To capture the entire output of the program, choose Select All . To capture only part of the output, choose Mark, then drag your mouse over the area you want to copy. In either case, the selected area will turn white.

codeblocks 14

3. Press the Enter key to copy of the selected text to the Windows copy/paste buffer.

4. Return to the edit window for your program. Add a comment at the bottom of your program and paste the text (CTRL-v) into that comment. Build and run the program to verify that the comment is correct and then save the file.

codeblocks 15

Saving and Restoring Projects

If you are working on a machine other than your own, you’ll need to take a copy of your project(s) with you. To do this, simply locate the folder containing your project and copy it to a removable disk, or to your network storage space. You can also archive the project folder as a zip file and email it to yourself.

To save space, you may want to remove unnecessary contents before copying or archiving your file. The bin and obj folders inside your project folder can both be safely deleted, since the contents of these folders will be recreated the next time you build your project.

The most important files are your source code (any .cpp or .h files that you have written). If you keep these files, it is possible to recreate your project by adding them to a new Code::Blocks project later.

If you need to return to work on a previous project, start Code::Blocks and load the old project. From the main menu, select FileOpen , then navigate to your project folder and locate the .cbp file. Select the .cbp file and press Open and you’ll be returned to the editing environment for your project. Return to step 8 in the section Using Code::Blocks and continue working.

Short Alternative
To quickly type and run a simple C++ program, you do the following:

1. Click File  New  Empty File or press Ctrl+Shift+N
2. Type your code in the blank window that opens.
3. Click File  Save File or press Ctrl+S.
4. Type the full name of your program file in double quotes (along with extension .cpp) e.g. to save a file with name First, save it as “First.cpp”
5. Now compile and run your program by clicking Build Build and Run or by pressing F9.

About

The main objective of this website is to provide quality study material to all students (from 1st to 12th class of any board) irrespective of their background as our motto is “Education for Everyone”. It is also a very good platform for teachers who want to share their valuable knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *