Hardware and software setup

Code Blocks IDE - setup and use. Code Blocks IDE - Setting Up and Using Integer Types

In this tutorial, you will find easy instructions with screenshots for installing the compiler (MINGW compiler), a tool that will allow you to convert the code you write into a program, and Code::Blocks, a free development environment for C and C++. This tutorial explains how to install Code::Blocks on Windows 2000, XP, Vista, or Windows 7. Note: if you're on Linux, follow the link to learn how to use GCC, if you're on OS X, click here to set it up with help from Apple xcode.

Step 1: Download Code::Blocks

  • Visit this site
  • Go to Download the binary release (direct link)
  • Go to Windows partition 2000/XP/Vista/7
  • Find the file that has mingw in the name. (The name at the time of writing was codeblocks-10.05 mingw-setup.exe; 10.05 versions may vary).
  • Save the file to your desktop. This is approximately 74 megabytes.

Step 2: Install Code::Blocks

  • Double click on the installer.
  • Click next a few times. Other installation guides assume you are installing to C:\Program Files\CodeBlocks (the default installation location), but you can install anywhere else if you wish.
  • Do a full installation
  • Run Code::Blocks

Step 3: Run in Code::Blocks

The Compilers auto-detection window will open in front of you:

When the automatic compiler detection window appears in front of you, just click OK. Code::Blocks may ask if you want to bind it to C/C++ file browsing by default - I advise you to do so.

Click on the File menu and under New , select Project... The following window will appear:

Click on Console Application and then Go . Click next until you reach:

You will be prompted to choose between C or C++. If you are not sure, use C++. V otherwise, select the language you are learning. (You can find tutorials on C and C++.)

After clicking Next , Code::Blocks will ask where you want to save the console application:

After clicking Next again, you will be prompted to configure the compiler:

You don't have to do anything, just click Finish and use the defaults.

Now on the left you can open the main.cpp file:

(You may need to expand the contents of the Sources folder if you can't see main.cpp).

You now have your main.cpp file, which you can modify as you wish. On the this moment, it just says: Hello World! , so we can run it as it is. Press F9 to compile first and then run it.

Now you have a working program! You can simply edit main.cpp and then press F9 to compile and run it again.

Now that you've finished installing the compiler, it's time to learn how to program: in C++ (or, if you're learning C, programming in C).

Troubleshooting

If something does not work, then most often a message appears:

CB01 - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping…

First, make sure you download the correct version of Code::Blocks, the one that contains MinGW . If this does not solve the problem, then most likely the problem is with the automatic detection of the compiler. you can check Current state"auto-detect" so. Go to Settings|Compiler and Debugger... . Then on the left select Global Compiler Settings (it has a gear icon) and on the right select the Toolchain executables tab. This tab has an Auto-Detect that can be used. This may fix the problem - if not, you can do it manually. The screenshot shows how it all looks on my system. Change the path marked Compiler's installation directory if you installed elsewhere, and make sure everything else is filled in as shown.

After you've done this, try pressing F9 again to see if you can run the program.

Good afternoon dear friends. With this article, I begin a series of lessons on one of the most popular programming languages ​​- c++. The lessons are aimed primarily at users who are not familiar with programming, so professionals, do not be strict, although I support criticism, especially in my address. In my tutorials, I will use the Code::Blocks development environment, which is free to download and use. Let's start of course with the classic Hello, world =)

I hope you've already downloaded and installed Code::Blocks, if so, let's get started. Launching the development environment

First of all, create a new empty project File->New->Project and select Empty project

click Go, then Next


and in the window that appears, in the Project title field, type the title of the project, in Project filename, the name of the project, and again Next.


In the next window, delete the Objects dir from the Create "Debug" configuration and Create "Release" configuration sections, as shown in the screenshot above, and click the Finish button. A project with the name "Hello world" should appear on the right.

The next step is to add the File->New->FIle... file to the project and select c/c++ source in the window that appears.

Again Go, Next, select c++, Next and see the following window

,

here we need to specify the file name (I called it main) and its path, preferably the folder with the project. Check the boxes for Debug and Release and click Finish.

And we got an empty c++ file in which we will write the program code itself.

Now we start writing the program code itself. To display information on the screen, we need the iostream input / output library.

#include

using namespace std ;

Then we write the main function that will be executed when the program starts.

int main()

it must be called "main" and we specify the type int for it (we will talk about this in the next lessons). Between curly braces and the program code will be found. We will write a simple program, which will display the greeting "Hello, world!" in the console.

cout<<"Hello world!" ;

After each command, you must put ";", this tells the compiler that the command is finished and you can process the next one. cout - outputs the values ​​of variables or strings to the command line.

Full listing of the program.

#include

using namespace std;

int main ()

cout<< "Hello, world!" ;

return 0 ;

We start the project and see the result.


Below is a video tutorial for this article.

If you have any questions, please write comments to This e-mail address is being protected from spambots. You must have JavaScript enabled to view. ,">This adress Email protected from spam bots. You must have JavaScript enabled to view., I will finalize the lessons or just help in studying the materials.

  • < Назад

Good afternoon dear friends. With this article, I begin a series of lessons on one of the most popular programming languages ​​- c++. The lessons are aimed primarily at users who are not familiar with programming, so professionals, do not be strict, although I support criticism, especially in my address. In my tutorials, I will use the Code::Blocks development environment, which is free to download and use. Let's start of course with the classic Hello, world =)

I hope you've already downloaded and installed Code::Blocks, if so, let's get started. Launching the development environment

First of all, create a new empty project File->New->Project and select Empty project

click Go, then Next


and in the window that appears, in the Project title field, type the title of the project, in Project filename, the name of the project, and again Next.


In the next window, delete the Objects dir from the Create "Debug" configuration and Create "Release" configuration sections, as shown in the screenshot above, and click the Finish button. A project with the name "Hello world" should appear on the right.

The next step is to add the File->New->FIle... file to the project and select c/c++ source in the window that appears.

Again Go, Next, select c++, Next and see the following window

,

here we need to specify the file name (I called it main) and its path, preferably the folder with the project. Check the boxes for Debug and Release and click Finish.

And we got an empty c++ file in which we will write the program code itself.

Now we start writing the program code itself. To display information on the screen, we need the iostream input / output library.

#include

using namespace std ;

Then we write the main function that will be executed when the program starts.

int main()

it must be called "main" and we specify the type int for it (we will talk about this in the next lessons). Between the curly braces and will be the program code. We will write a simple program that will display the greeting "Hello, world!" in the console.

cout<<"Hello world!" ;

After each command, you must put ";", this tells the compiler that the command is finished and you can process the next one. cout - outputs the values ​​of variables or strings to the command line.

Full listing of the program.

#include

using namespace std;

int main ()

cout<< "Hello, world!" ;

return 0 ;

We start the project and see the result.


Below is a video tutorial for this article.

If you have any questions, please write comments to This e-mail address is being protected from spambots. You must have JavaScript enabled to view. ,">This email address is being protected from spambots. You must have JavaScript enabled to view., I will finalize the lessons or just help in studying the materials.

  • < Назад

Code::Blocks is a free and open source integrated development environment (IDE) that supports the use of various compilers. By default, Code::Blocks uses the MinGW compiler that comes with the bundle (you can download the distribution without the built-in compiler). MinGW is a variant of the GNU C/C++ compiler for Windows. MinGW is short for "Minimalist GNU for Windows". The MinGW suite includes open source programming tools that do not depend on any paid third-party libraries. It is used by many development environments ( visual studio uses its own compiler). MinGW includes the GNU Compiler Collection (GCC), including the C, C++, ADA, and Fortran compilers. Code::Blocks has an open architecture, which allows it to be scaled using plug-ins (you can write programs for both windows, linux, and various microprocessors such as avr and stm32). The code debugger in Code::Blocks supports breakpoints in source code or in data that the program is processing.

Code::Blocks is available for Windows, Linux and Mac OS X. The project website is codeblocks.org .

Installing the MinGW Compiler

Installing Code::Blocks itself is straightforward. It is only advisable to install it in a folder, in the path to which there are no spaces or Cyrillic. Consider installing the MinGW compiler. Typically, the Code::Blocks distribution contains old version MinGW compiler, so it is advisable to download Code::Blocks without the MinGW compiler and install the compiler separately. First, download the installer from the mingw.org project site. After launch, the following window will appear.


Click Install and get the following window.


Here in the field Installation Directory specify the location of the compiler files. The default is C:\MinGW, we leave it. Click Continue and the download and installation of the manager for installing MinGW begins.


Click Continue and get the following window.


For programming in C ++, select packages to install mingw32-base-bin (A Basic MinGW Installation) and mingw32-gcc-g++-bin (The GNU C++ Compiler) and then click on the menu Installation -> Apply Changes. A window will appear showing the download of the selected packages.


After downloading the packages, click on the button close

The first time you run Code::Blocks, it will automatically detect the installed compiler. In case of problems, go to the menu Settings -> Compiler... and on the tab Toolchain executables check the correct path to MinGW, as well as the names of the compiler and linker files. Now you can create a project.

Create a project

To create a project, go to the menu File -> New -> Project...


In the window that appears, select the required project type. Here we see that Code::Blocks has a large number of project templates. In our case, this console application(console application).


In the next window, select the programming language used. Select C++ and click on the button Next.


Further into the field project title enter the name of the project. In our case, this test. Here we indicate the location of the project on the disk (field Folder to create project in). In the folder we specified, Codeblcoks will automatically create a folder with the previously specified project name. After specifying the folder name and file name, click on the button Next.


In the next window, select the compiler. By default, the GNU GCC Compiler is selected, which we will use.


We press Finish and we get a minimal program, the so-called Hello World!


Press F9 to compile and run the program and get the following window.


Cyrillic support in the console

The code of a standard project generated by the Code::Blocks environment does not support input and output of Cyrillic characters in the console. To solve this problem, you first need to make small changes to the project code. Example source code shown below.

Source

#include #include using namespace std; int main() ( SetConsoleCP(1251); // set win-cp codepage 1251 to input stream SetConsoleOutputCP(1251); // set win-cp codepage 1251 to output cout

Next, you need to run the program, left-click on the window title (where the path to the running .exe file is shown) and in context menu select item Properties. Then on the tab Font install font Lucida Console and choose a convenient font size. After that, messages in console applications will support Cyrillic characters.

Code::Blocks is a free cross-platform development environment. Code::Blocks is written in C++ and uses the wxWidgets library. Having an open architecture, it can be scaled with plug-ins. Supports C, C++, D programming languages ​​(with restrictions).
Code::Blocks is being developed for Windows, Linux and Mac OS X. The environment can be built from source for almost any Unix-like system. [ http://en.wikipedia.org/wiki/Code::Blocks ]

In order to enable the Russian language, you need to do the following:

1. The archive must be unpacked into the subfolder of the program (where it is installed), for example C:\Program Files (x86)\CodeBlocks\share\CodeBlocks
2. After starting the program, select Settings -> Environment -> View, check the "Internationalization" box and select "Russian" from the list.

3. We restart the CodeBlocks program and get Russification.


The Russian language has been successfully connected to Code::Blocks version 13.12.

The archive already contains the folder structure locale\ru_RU (to be placed in \CodeBlocks\share\CodeBlocks)

Translation status:
Messages: 2173
Translated: 2173 (100.0%)
Untranslated: 0 (0.0%)
Shared between Ubuntu and upstream: 2173 (100.0%)
Translated differently between Ubuntu and upstream: 0 (0.0%)
Only translated on this side: 0 (0.0%)

Liked the article? Share with friends!
Was this article helpful?
Yes
Not
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thank you. Your message has been sent
Did you find an error in the text?
Select it, click Ctrl+Enter and we'll fix it!