Development environment with code blocks getting started. Code Blocks IDE - setup and use. Installation for operating system of the Linux family

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. As a rule, the Code::Blocks distribution contains an old version of the 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. An example source code is 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 select the item in the context menu 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 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%)

Integrated Development Environment (IDE) Code::Blocks (hereinafter referred to as CB) is a complete product for developing C/C++ applications. CB is a cross-platform framework developed using the wxWidgets tool library. There are versions of the environment for both Windows and other operating systems (OS) - Linux and Mac OS. This IDE is completely free, open source and built entirely using open source technologies. One of CB's greatest strengths is its support for creating wxWidgets applications - that is, such software (software) that uses the OS API to draw a graphical user interface (GUI). In other words, CB allows you to create cross-platform software for every taste.

CB is able to work with a large number of compilers. If there are several of them installed in the system, you can easily switch between them, depending on the need. Plus, at the installation stage, the IDE itself will scan the system for available compilers and offer to use one as the main one. You can later change these settings both globally and on a project-by-project basis. For global environment settings, there is a whole "Settings" section in the main CB menu. To make any specific settings specific to a particular project, you need to open the project properties window. To do this, you need to call the context menu of the project by right-clicking on it, and select the "Properties" item. The projects themselves (currently open in the IDE) are displayed as a tree in the "Management" dock panel, in its "Projects" tab. Now, in the properties window that opens, you can configure a wide variety of parameters, from editing build targets to connecting third-party libraries. The "Project's build options" button on the "Project Settings" tab of the same properties window will allow you to very flexibly configure the build configuration for a specific project: compiler keys, select the compiler itself, include libraries for the linker, etc. All this can be done for individual modes: "Release" "Debug".

The CB GUI is built around floating and stretchable dock panels that can be docked to any side of the main IDE window by simply dragging them with the mouse. Thanks to this, you can very flexibly customize different interface layouts for different screen sizes, optimizing the ergonomics of the GUI. If there are several monitors, it is convenient to separate some panels from the main window and place them on adjacent monitors.

Highlighting, code completion and editing tools in CB make the process of working with code easy and comfortable. A huge arsenal of settings allows you to fine-tune the environment "for yourself." Very useful is the support for working with environment variables. Thanks to this feature, CB can be very closely integrated into the system and its capabilities can be extended, for example, in this way you can connect the wxWidgets library.

By the way, for developing GUI applications based on wxWidgets, CB has a built-in RAD tool for GUI construction - wxSmith. This is a fairly powerful utility, although not exactly easy to learn.

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 cross-platform C/C++ development environment. It is currently the best free C development environment.

Code::Blocks is being developed for Windows, Linux and Mac OS X.

In a Windows environment, it is most convenient to download this environment as part of an assembly that already has all the necessary libraries to get started. The assembly does not require installation and works according to the principle: “Unpack and work”.

Code::Blocks supports the following compilers:

  • GNU GCC (incl. G77) (Linux)
  • MinGW GCC (incl. G77) (Win32)
  • MSP430 GCC (Win32)
  • TriCore and PowerPC GCC (Win32, Linux)
  • Apple GCC (Xcode) (Mac OS X)
  • Microsoft Visual C++ Toolkit 2003 (Win32)
  • Microsoft Visual C++ 2005 (Win32)
  • Borland's C++ Compiler 5.5 (Win32)
  • DigitalMars C/C++ (Win32)
  • OpenWatcom (Win32)
  • Intel C++ compiler (Win32)
  • Small Device C Compiler (SDCC)
  • Digital Mars D
  • GDC D Compiler
  • LLVM D Compiler

Ready templates

CodeBlocks has ready-made project templates that allow you to quickly create a minimal application.

Code editor

The code editor has all the features for comfortable work of the programmer:

  • Syntax highlighting (can be customized)
  • Tabbed interface
  • Code completion
  • Class Browser
  • Smart Indent
  • One click exchange between .h and .c/.cpp files
  • Custom keyboard shortcuts
  • External custom "Tools"
  • To-do list management with different users

The number of editor settings is simply huge:

In addition to general settings, it is also configurable:

  • Code folding
  • Fields and Cursor
  • Syntax highlighting (separately by file type)
  • Default code for generated files (you can insert an autosignature)
  • Abbreviations (when you enter an abbreviation, it is automatically expanded into code)
  • Code Formatting
  • How to save and return to lines of code
  • Code completion
  • Customizing code statistics
  • Code Documentation Generation
  • and much more

Plugins

The editor's capabilities can be extended with plugins. For example:

  • HEX editor
  • Nassi Schneiderman diagrams
  • Export source code to other formats
  • Keystroke macros
  • Hot keys for menu
  • Incremental Search
  • Environment Variables
  • and many others

Debugger

As the default debugger, CodeBlocks uses GDB, the most popular C debugger developed by Richard Stallman.

The debugger allows you to set breakpoints and then step through code while monitoring variables and arrays. You can also track stacks of called functions.

Results

The number of features and settings of the CodeBlocks environment make it possible to turn this environment into an excellent tool for a C programmer.



Continuing the topic:
Windows

Natalya Komarova , 05/28/2009 (03/25/2018) When you read a forum or blog, you remember the authors of the posts by nickname and ... by the user's picture, the so-called avatar ....