Как найти компилятор codeblocks

When you launch Code::Blocks for the first time, it will scan the system for any supported compilers. Once this scan has finished, Code::Blocks will have been correctly configured for any detected compilers. Code::Blocks will also have default configurations even for compilers that were not found.

This article is a guide for obtaining, installing, and configuring the various compilers that Code::Blocks can use.

Compiler-neutral setup steps

Before using a compiler with Code::Blocks you have to install it. The method for installing the compiler depends on the Operating system you’re using, the Compiler you intend to use and so on.
If you installed the compiler on its default installation directory, there is nothing more to configure (if the compiler is natively supported by Code::Blocks). Launch Code::Blocks and you’re all set 🙂

  • If that is not the case, launch Code::Blocks. If it is the first time you launch it, the compiler auto-detection will be launched.
  • If your compiler was not auto-detected, go to “Settings->Compiler and Debugger->Global Compiler settings->Toolchain executables”, select the compiler you installed and press “Auto-detect”.
  • If you get a message saying that the compiler was auto-detected, congratulations!
  • If not, then press the button with the three dots next to the “Auto-detect” button and select the installation directory of your compiler manually.

NOTE: The compiler’s installation directory is exactly this: the installation directory. Not the “bin” subdirectory nor any other.

Windows

Once you’ve installed a new compiler, be sure to read the Compiler-neutral setup steps at the end of this article.

At the time of this writing, Code::Blocks supports the following compilers in Windows:

  • MinGW GCC C/C++ Free Compiler, including GFortran
    • Cygwin GCC C/C++ Free Compiler
      • HOWTO: Use Cygwin 1.7 with Code::Blocks
  • MSP430 GCC C/C++
  • TriCore GCC C/C++
  • PowerPC GCC C/C++
  • Small Device Free C Compiler (SDCC)
  • Digital Mars Free C/C++ Compiler
  • Digital Mars D Compiler for Windows

These compilers are generally still under active development by their publishers, so a new version of their software could be released that is incompatible with the current version of Code::Blocks.

The following compilers are still supported by Code::Blocks, but are no longer available from their original publishers.

  • Microsoft’s Visual C++ 2003 – 2010
  • Borland’s C/C++ Free Compiler 5.5

The following publishers have released newer versions of their compilers which should be tested against the current configuration. In other words, it is not known yet whether these compilers still work with Code::Blocks.

  • OpenWatcom Free C/C++ Compiler
  • Intel C/C++ Compiler

MinGW/GCC

The official MinGW website is at mingw.org. A MinGW-bundled version of the latest Code::Blocks release is available from the Code::Blocks download page. If you install this version, the GCC compiler will be automatically detected and set as the default. Also you can use the TDM’s GCC/mingw32 Builds from [1] or [2].

Note: In any case, if you don’t install MinGW in C:MinGW, you’ll need to update the configuration of GCC in Code::Blocks.

Official MinGW.org

You can install MinGW yourself, by using an automatic downloader/installer or by downloading and unpacking the required packages by hand from mingw.org, here: [3].

Packages required (suggested) for MinGW/GCC v3.4.5:

  • Compiler:
    • gcc-build-3.4.5-20060117-3.tar.gz
    • gcc-core-3.4.5-20060117-3.tar.gz
    • gcc-g++-3.4.5-20060117-3.tar.gz
  • Components:
    • binutils-2.19.1-mingw32-bin.tar.gz
    • gdb-6.8-mingw-3.tar.bz2
    • mingw32-make-3.81-20080326.tar.gz
    • mingwrt-3.16-mingw32-dev.tar.gz
    • mingwrt-3.16-mingw32-dll.tar.gz
    • w32api-3.13-mingw32-dev.tar.gz

Packages required (suggested) for MinGW/GCC v4.4.0:

  • Compiler:
    • gcc-full-4.4.0-mingw32-bin-2.tar.lzma
  • Components:
    • binutils-2.19.1-mingw32-bin.tar.gz
    • gdb-6.8-mingw-3.tar.bz2
    • mingw32-make-3.81-20080326.tar.gz
    • mingwrt-3.16-mingw32-dev.tar.gz
    • mingwrt-3.16-mingw32-dll.tar.gz
    • w32api-3.13-mingw32-dev.tar.gz

HOWTO: Use Cygwin 1.7 with Code::Blocks

Cygwin 1.7 changed the way symlinks were created and handled when invoked from a command prompt. I couldn’t find a way to force CB to use a unix-link shell, but was able to find a work around when perusing the Cygwin mailing lists.

The symptom would show up with a message similar to the one below:

 Execution of 'g++.exe -Wall -fexceptions  -g     -c c:/dev/code/cb1/main.cpp -o obj/Debug/main.o' in 'c:devcodecb1' failed.

Executing the same command from the CMD.EXE prompt yields an “Access is denied” message. This was how I was able to track down why the issue occurred. For more info, see this cygwin mailing list thread: http://www.mail-archive.com/cygwin@cygwin.com/msg104088.html

Solution

The solution is to point your compiler and linker directly to the version of gcc and g++ that you want to use.

In my case, I wanted to use gcc-4.exe and g++-4.exe and so, I went into Settings->Compiler and Debugger->Toolchain executables. There I changed the “C Complier”, “C++ Compiler” and “Linker for dynamic libs” to point to gcc-4.exe, g++-4.exe and g++-4.exe.

After this, compilation and linking worked fine.

It would also be a good idea to add an environment variable CYGWIN with a value of nodosfilewarning in Settings->Environment->Environment Variables. This eliminates the following (harmless) warning message:

 MS-DOS style path detected: c:/
   Preferred POSIX equivalent is: /c
   CYGWIN environment variable option "nodosfilewarning" turns off this warning.
   Consult the user's guide for more details about POSIX paths:
     http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

See also: Installing Cygwin Compiler

(Unofficial) TDM – “Twilight Dragon Media”

These packages are called TDM’s GCC/mingw32 Builds and can be obtained from [/index.php/topic,10508.0.html] or [4].

Packages required (suggested) for TDM’s GCC/mingw32 Builds v4.4.1-tdm-2 SJLJ:
…which can be found here: [5] under: TDM-GCC 4.4 series -> 4.4.1-tdm-2 SJLJ.

  • Compiler:
    • gcc-4.4.1-tdm-2-core.zip
    • gcc-4.4.1-tdm-2-g++.zip
  • Components:
    • binutils-2.19.1-mingw32-bin.tar.gz
    • gdb-6.8-mingw-3.tar.bz2
    • mingw32-make-3.81-20080326-3.tar.gz
    • mingwrt-3.16-mingw32-dev.tar.gz
    • mingwrt-3.16-mingw32-dll.tar.gz
    • w32api-3.13-mingw32-dev.tar.gz

These packages are included in both the Bundled Installer and the On-Demand Installer available via TDMs page referenced above for users who do not wish to download and install them manually.

Embarcadero C++ Compiler BCC32C

Formerly Borland’s C++ Compiler, this compiler is now published by Embarcadero, with active on-going development; the current version is 10.1 as of this writing. Go to their product download page to download. You will be asked to enter some registration information (registration is free) then the download will begin. You will receive a ZIP archive which contains installation instructions in a text file in the root directory of the archive; it does not have an installer program.

Digital Mars C/C++ Free Compiler

Go to DigitalMars. Accept the license agreement and you’ll be redirected to a page containing download links.

In that page, download:

  • The Digital Mars C/C++ Compiler (dm8**c.zip)
  • The Basic Utilities (bup.zip)
  • The STLport library (stlport.zip)

Open dmbinsc.ini in a text editor, and replace the line

INCLUDE="%@P%..include";"%@P%..mfcinclude";%INCLUDE%

with

INCLUDE="%@P%..stlportstlport";"%@P%..include";"%@P%..mfcinclude";%INCLUDE%

Intel C++ Compiler

Please note that on Windows platform, Intel C/C++ compiler requires Microsoft Visual C++[6] to be present in your system in order to function properly. It will not compile any C++ program without it. You should also note that Windows SDK[7] shall be installed in order to compile Windows app.

Code::Blocks (C::B) is now able to detect (from svn revision 4967 onwards) Intel C/C++ compiler and it’ll then automatically setup the MSVC compiler so that the Intel compiler works as intended. However if you wish to manually install the Intel C/C++ compiler, then follow the following steps.

  • Go to Settings > Compilers and debuggers and then select Intel C/C++ compiler.
  • Click on the Toolchain executables tab. Point to the installation directory, e.g. C:Program FilesIntelCompilerC++10.1.020IA32 , inside the Compiler’s installation directory textbox.
  • Click on the Additional Paths tab and fill in the directories pointing to MSVC bin directory and the Windows SDK directory. It may look like-
C:Program FilesMicrosoft Visual Studio 8VCbin
C:Program FilesMicrosoft Visual Studio 8Common7IDE
C:Program FilesMicrosoft SDKsWindowsv6.0bin
  • Click on the Search directories tab and add the include directories containing headers offered by Intel C/C++ compiler, MSVC compiler and the Windows SDK headers to Compiler and Resource compiler. It may look like-
C:Program FilesIntelCompilerC++10.1.020IA32include
C:Program FilesMicrosoft Visual Studio 8VCinclude
C:Program FilesMicrosoft SDKsWindowsv6.0Include
  • Click on the Linker tab under Search directories tab and add the directories containing libraries offered by Intel C/C++ compiler, MSVC compiler and the Windows SDK. It may look like-
C:Program FilesIntelCompilerC++10.1.020IA32lib
C:Program FilesMicrosoft Visual Studio 8VClib
C:Program FilesMicrosoft SDKsWindowsv6.0Lib

Click on the OK button to save the settings. Now you should be able to use Intel C/C++ compilers on Windows with C::B.

Note: The directories specified above may be different on your PC.

Digital Mars D Compiler for Windows

Now Digital Mars D Compiler (DMD) supports 32bit Windows, and in future it will support 64bit Windows.
If you want to build D program in CodeBlocks on 32bit Windows, please following the instructions as bellow.

1). Install DMD(2.0) into your Windows system.

You should correctly combine the DMD compiler and install it into your system. Please view the instructions on digitalmars.com website.
DMD for Windows http://www.digitalmars.com/d/2.0/dmd-windows.html

The newest DMD2 source you can get here: https://github.com/D-Programming-Language

2). Settings in CodeBlocks.

You should add correct DMD pathes into CodeBlocks Global compiler settings

   2.1). "Settings -> Compiler and debugger settings" and choose compiler to "Digital Mars D Compiler";
   2.2). click "Compiler settings -> Other options", add  -m32  into the field;
   2.3). click "Linker settings", and add "D:ProgramDMD2windowslibphobos.lib" into the "Link libraries";
   2.4). click "Search directories -> Compiler", and add "D:ProgramDMD2srcphobos" into the field;
   2.5). click "Search directories -> Linker", and add "D:ProgramDMD2windowslib" into the field;
   2.6). click "Toolchain executables", add "D:ProgramDMD2windows" into the "Compiler's installation directory" filed;
         (if you installed DMD2 correctly acc. to Installation setp, just click 'Auto-detect' button.)
   2.7). Additional: If you wan to specify the DMC (Digital Mars C/C++ Compiler) you can do like this:
         click "Toolchain executables -> Additional Paths", and add "D:ProgramDMCbin" into the field.

The “D:ProgramDMD2” or “D:ProgramDMCbin” here should change to your own DMD or DMC path in your system.

3). Testing D program in CodeBlocks.

In CodeBlocks, produce a D Application project, and input your own D code into the .d file in the project, then build/run.

Linux

At the time of this writing, Code::Blocks supports the following compilers in Linux:

  • GNU GCC C/C++ Free Compiler
  • Small Device Free C Compiler (SDCC)
  • Intel C/C++ Compiler
  • Digital Mars D Compiler for Linux

Digital Mars D Compiler for Linux

Now Digital Mars D Compiler (DMD) supports 32bit and 64bit Linux, and ‘support Linux library’ is under construction. If you want to build D program in CodeBlocks on 32bit and 64bit Linux, please following the instructions as bellow.

1). Install DMD(2.0) into your Linux system.

You should correctly combine the DMD compiler and install it into your system. Please view the instructions on digitalmars.com website.
DMD for Linux http://www.digitalmars.com/d/2.0/dmd-linux.html

The newest DMD2 source you can get here:
https://github.com/D-Programming-Language

2). Settings in CodeBlocks.

A). 32bit Linux & 32bit DMD2.

On 32bit Linux, you should combine 32bit DMD2 from DMD2 source and install it into your system.

You should add correct DMD pathes into CodeBlocks Global compiler settings.

   A.1). "Settings -> Compiler and debugger settings" and choose compiler to "Digital Mars D Compiler";
   A.2). click "Compiler settings -> Other options", add  -m32  into the field.
   A.3). click "Linker settings", and add "/opt/dmd2/linux/lib32/libphobos2.a" into the "Link libraries". 
   A.4). click "Search directories -> Compiler", and add "/opt/dmd2/src/phobos" into the field.
   A.5). click "Search directories -> Linker", and add "/opt/dmd2/linux/lib32" into the field. 
   A.6). click "Toolchain executables", add "/opt/dmd2/linux" into the "Compiler's installation directory" filed.
   A.7). change the value of "Program Files -> Linker for dynamic libs" to "gcc -m32 -lrt" or "gcc -lrt".

If you installed DMD2 to a different path, please modify “/opt/dmd2” to your own DMD2 path.

B1). 64bit Linux & 64bit DMD2.

On 64bit Linux, you can combine 64bit DMD2 from DMD2 source and install it into your system.

You should add correct DMD paths into CodeBlocks Global compiler settings.

   B1.1). "Settings -> Compiler and debugger settings" and choose compiler to "Digital Mars D Compiler";
   B1.2). click "Compiler settings -> Other options", add  -m64  into the field.
   B1.3). click "Linker settings", and add "/opt/dmd2/linux/lib64/libphobos2.a" into the "Link libraries". 
   B1.4). click "Search directories -> Compiler", and add "/opt/dmd2/src/phobos" into the field.
   B1.5). click "Search directories -> Linker", and add "/opt/dmd2/linux/lib64" into the field. 
   B1.6). click "Toolchain executables", add "/opt/dmd2/linux" into the "Compiler's installation directory" filed.
   B1.7). change the value of "Program Files -> Linker for dynamic libs" to "gcc -m64 -lrt" or "gcc -lrt".

If you installed DMD2 to a different path, please modify “/opt/dmd2” to your own DMD2 path.

B2). 64bit Linux with 32bit DMD2.

On 64bit Linux, you can combine 32bit DMD2 with 64bit together from DMD2 source and install them into your system.

You should add correct DMD paths into CodeBlocks Global compiler settings.

   B2.1). "Settings -> Compiler and debugger settings" and choose compiler to "Digital Mars D Compiler";
   B2.2). click "Compiler settings -> Other options", add -m32 into the field.
   B2.3). click "Linker settings", and add "/opt/dmd2/linux/lib32/libphobos2.a" into the "Link libraries". 
   B2.4). click "Search directories -> Compiler", and add "/opt/dmd2/src/phobos" into the field.
   B2.5). click "Search directories -> Linker", and add "/opt/dmd2/linux/lib32" into the field. 
   B2.6). click "Toolchain executables", add "/opt/dmd2/linux" into the "Compiler's installation directory" filed.
   B2.7). change the value of "Program Files -> Linker for dynamic libs" to "gcc -m32 -lrt".

If you installed DMD2 to a different path, please modify “/opt/dmd2” to your own DMD2 path.

3). Testing D program in CodeBlocks.

In CodeBlocks, produce a D Application project, and input your own D code into the .d file in the project, then build/run.

Downloading the GNU GCC compiler & GDB debugger

Under Linux you’ll, most probably, already have everything that is needed in order to compile. All major Linux distributions (RedHat, Debian, SuSE, Mandriva, Gentoo, ArchLinux, etc) come with GCC & GDB preinstalled. To make sure you have have gcc installed, go to your terminal and type ‘gcc -v’. In case you have GCC installed, you will get GCC’s compile options and version number.

Mac OS X

The Mac OS X port efforts has began recently, but it should be a matter of time until these compilers will be supported:

  • GNU GCC
  • Intel Compiler beta (not yet released to public)
  • Small Device C Compiler (SDCC)

Downloading the GNU GCC compiler & GDB debugger

Under Mac you’ll need to install a compatible version Xcode Tools from http://developer.apple.com/tools/ (or http://developer.apple.com/downloads). You need the “Command Line Tools”.

This will install Apple versions of:

http://www.gnu.org/software/gcc/

http://www.gnu.org/software/gdb/

http://www.gnu.org/software/make/

Setting up compiler switches

Usually you need to tweak the compiler options to be able to compile C++ applications – that’s the stuff Xcode hides from your eyes, but you better should know. You need to point to the GNU compiler’s C/C++ include folders, to the GNU linkers libraries folder and a adjust the compiler options to setup the GNU compiler root path. Those path’s differ depending on what hardware (processor architecture) and what version of MacOS is used. For an Intel based Mac with MacOS 10.6.2 and Xcode v3.2.2 the following should work:

Compiler search directories (“include” folders):


/Developer/SDKs/MacOSX10.6.sdk/usr/include


/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1

Linker search directories (“library” folders):


/Developer/SDKs/MacOSX10.6.sdk/usr/lib


/Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1

Additional compiler flags:


-isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -gdwarf-2

Remote Compilation

Remote compilation is not directly supported by Code::Blocks, however, the following articles explain two remote compilation systems, which use 3rd party programs to provide this functionality:

Installing Uniwin remote compiler
Using Xming for remote compilation

Misc. Custom Compilers

There are several user contributions for different (non-C/C++) compiler which are listed here:

https://wiki.codeblocks.org/index.php?title=User_documentation#Compilers

OK, so I downloaded Codeblocks and I already have a cygwin terminal on my computer that I regularly use to compile and run C programs, but when I try to build a program in CodeBlocks, it gives me an error:

The compiler's setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.

I don’t know why it can’t find my compiler or why it’s looking for GNU GCC compiler when I have Cygwin GCC as the default compiler.

Alexey Gorozhanov's user avatar

asked Mar 10, 2014 at 19:29

lbomb22's user avatar

6

I faced the same problem. I have fixed out by going to Setting -> Compiler -> Global Compiler Settings -> Toolchain Execuatables (tab). There, click on Program Files and then rename C compiler to gcc.exe and C++ compiler to g++.exe.

answered Aug 14, 2015 at 15:29

SilverSurfer's user avatar

SilverSurferSilverSurfer

6561 gold badge6 silver badges23 bronze badges

I know this is an old question but let me see if I can help. First of all, on the download page make sure you downloaded codeblocks-13.12mingw-setup.exe and NOT codeblocks-13.12-setup.exe. Of course the version numbers may change but pay attention to the name. Then after installing codeblocks, go to Settings->Compiler->Toolchain executables. From here, change the C compiler to gcc.exe and C++ compiler to g++.exe.
Hope this helps anyone else going through this problem 🙂

answered Sep 22, 2015 at 13:00

Patrice Andala's user avatar

I think the major problem is that most of us creates a project and then applies the Compiler’s configuration and waits till the project applies the configured changes.

Well , this is TOTALLY WRONG if you created the project before configuring the Compiler , the project won’t change it’s Compiler , so you need to reconfigure your created project by :
Right Click on the project -> Select Build Options -> Reconfigure the selected compiler to CygwinGCC .

answered Dec 21, 2019 at 5:13

TheSalamov's user avatar

TheSalamovTheSalamov

8679 silver badges16 bronze badges

0

If you change the default path of codeblocks while installation, then you may be suffering from this problem.

If you go to Settings>Global compiler settings>Toolchain executables(tab) and see the Compiler’s installation directory, it may be set by default to C:MinGW something like that.

Just press the Auto-detect button and it will find the actual directory of the compiler.

Click OK and you are ready to Code!

answered Sep 4, 2019 at 11:41

Arulyan Asokan's user avatar

I think you have not set your compiler.You have to choose the compiler you want to use. For this purpose click ‘Settings’->
‘Compiler and Debugger’ and select
‘Other Settings’ in the drop-down field.Choose your own compiler and save it.Now rerun your program.

answered Mar 10, 2014 at 19:40

learner's user avatar

learnerlearner

4,5327 gold badges54 silver badges96 bronze badges

1

Go to:

Settings -> Compiler... -> Toolchain executables(Tab)

In the compiler’s installation directory choose the folder where your compiler is.

valter

answered Mar 10, 2014 at 19:45

γηράσκω δ' αεί πολλά διδασκόμε's user avatar

2

I solved this problem
I firstly downloaded codeblocks-17.12-setup.exe and then added MinGW directory location at Setting -> Compiler -> Global Compiler Settings -> Toolchain Execuatables (tab) -> compiler installation directory” but it did n’t work then downloaded codeblocks-13.12mingw-setup.exe and did the same process again and it worked.

answered Jul 17, 2019 at 19:30

Saif Ul Islam's user avatar

Go for this tutorial

As you already have a compiler installed, start from item “Code::Blocks Configuration”.

In a nutshell,

1.Settings – Compiler

2.Select Compiler

3.Go for Toolchain executables

4.Find your compiler installation directory and configure the settings accordingly

5.Settings – Debugger

6.Select Default in the drop-down menu

7.Fill in the textbox Executable path with the correct path

8.Click OK, close the window and you are good to go.

Dulaj Kulathunga's user avatar

answered Jan 4, 2020 at 7:51

frizzo's user avatar

I tried this way :

  1. You need to download tdm64-gcc 9.2.0 or current version.
  2. Run it and in the setup, click create.
  3. Select MinGW / TDM (32-bit) – Next.
  4. Installation Directory – Next.
  5. Select the type of instal -> TDM-GCC – 32

In the options below make sure that the “Add to path” option is checked. – Next.

On codeblocks:

Settings
     Compiler
          Toolchain
          executables
          Auto-detect

Settings
     Debugger
          Default
   Executable
   path: C:TDM-GCC-32bingdb32.exe

Florian Castellane's user avatar

answered Apr 1, 2020 at 0:29

Dan Azevedo's user avatar

i have just solved the problem.

it happening because the path of you compilers is not correct in settings.code blocks downloads and installs compilers for you. you don not need to it manually.
thus in some cases it takes wrong path of location of compilers.

now heres the solution:-
1. right click on code blocks and go to properties and copy its location,and open command promt tpye cd and past the location. if you know what this all about then just go to file where your code block is install.

2.you will found MinGW directory or folder.

3.right click on the folder, copy its location

4.open code blocks,go to settings which u will find in menu.

5.go to compilers and then go to toolchain executable

6.u will see compiler’s installation directory past our location in white box below that.

  1. CLICK OK

you have solved ur problem. if this dose not work then try reinstalling

answered Apr 19, 2017 at 9:24

I have just solved this problem.

In addition to above mentioned solutions , you can follow the path in “Setting -> Compiler -> Global Compiler Settings -> Toolchain Execuatables (tab)” and check the path for Compiler’s installation directory. If it is blank, then click on “Auto Detect” tab. It will update the installation directory.

answered Jan 5, 2019 at 12:48

Vinod's user avatar

I just solved the problem.
Click ‘Settings->Compiler and debugger->Toolchain executables’.Now in “Compiler’s installation directory” click on ‘Auto-detect’ or browse to the path of compiler. It can be found usually at “C:Program Files (x86)CodeBlocks-EPMinGW”, if Codeblocks is installed in C-drive.

answered Jan 29, 2019 at 17:36

Vaibhav Khamankar's user avatar

Устанавливаем Code::Blocks + MinGW

Здравствуйте, уважаемые читатели! Здесь пойдет речь об установке среды разработки программ на C++ — Code::Blocks. Данная программа бесплатная, но от этого она не становится мало функциональной пустышкой. В ней присутствуют множество функций для разработки небольших программ на C++, а также серьезных проектов. Вместе с ней в комплекте можно скачать компилятор MinGW, который необходим для компиляции ваших программ.

 Скачивание необходимых файлов

В начале нам нужно скачать на компьютер файл необходимый для установки Code::Blocks и MinGW. Благо, на официальном сайте Code::Blocks, нам предоставляют возможность скачать и установить оба компонента одним кликом (может двумя). Для скачивания следуем инструкции:

  1. Переходим на официальный сайт данной IDE (http://www.codeblocks.org/downloads).
  2. Здесь у вас есть выбор способа установки, но я вам советую кликнуть по ссылке Download the binary release. Это самый простой способ из присутствующих, о котором дальше и пойдет речь.
  3. На открывшийся странице выберите свою операционною систему или найдите ее самостоятельно, пролистав вручную.
  4. Теперь в таблице с возможными файлами для установки выбираем тот, в названии которого присутствует mingw (например, codeblocks-<версия>mingw-setup.exe).
  5. Сохраните файл и дождитесь окончания загрузки. Файл весит не много, так что заскучать не успеете 🙂 .

Установка Code::Blocks

После скачивания установочного файла можем приступать к самой установке программы. Для этого нам потребуется совершить пару телодвижений:

  1. Открываем пакет установки Code::Blocks.
  2. Жмем Next >.
  3. Жмем I Agree.
  4. Здесь мы можем выбрать различные виды установки либо настроить ее самостоятельно. Я предпочитаю Full версию установки. Жмем Next >.
  5. Можете выбрать другой каталог установки Code::Blocks вместо стандартного. Жмем Install.
  6. Ждем…
  7. Жмем Finish!

Теперь у вас установлена полноценная среда разработки Code::Blocks!

Однако на этом еще не все. Остался последний штрих.

При первом запуске у вас попросят указать, какие расширения файлов будут привязаны к Code::Blocks по умолчанию. Здесь особой разницы нет. Я выбираю Yes, associate Code::Blocks with C/C++ file types.

Если мы все правильно сделали, то должны увидеть экран приветствия:

Стандартное окно приветствия Code::Blocks

Чтобы окончательна удостоверится в работоспособности IDE, давайте запустим тестовою программу.

Для этого жмем File -> New -> File… После чего открывается диалоговое окно:

Диалоговое окно выбора типа файла

  1. Выбираем C/C++ source. Жмем Go.
  2. Жмем Next >. Можем поставить галочку Skip this page next time чтобы в следующий раз лишний раз не пролистывать эту страницу.
  3. Выбираем C++ и идем дальше.
  4. Выбираем расположения файла и жмем Finish!

Теперь у вас должно открыться окно для написания кода. Скопируйте или напишите сами данный код:

#include <iostream>

using namespace std;

int main() {

    cout << “Hello, world!” << endl;

    return 0;

}

Теперь для запуска программы нажмите кнопку F9 (компиляция и запуск). У вас должно появится окно где будет написано наше тестовое сообщение:

Hello, world!

Process returned 0 (0x0) execution time : 0.020 s

Press any key to continue.

Вот и наше тестовое сообщение!

Возможные ошибки

Довольно распространенной проблемой является отсутствия компилятора по указанному пути в настройках Code::Blocks. У этой проблемы есть две причины:

  • Либо вы установили пакет без MinGW. Соответственно вернитесь вверх и проверьте правильность выполненных шагов.
  • Возможно, автоматические прописанный путь к компилятору является неверным. Тогда укажите путь к компилятору самостоятельно (он должен быт в директории установленного Code::Blocks, которую вы указывали при установке): Settings -> Compiler -> Global compiler settings -> Toolchain executables:

Настройки компилятора в Code::Blocks

Если это не решило проблему, то пишите в комментарии свою проблему (также дополняйте сообщения скриншотами ошибок) и мы обязательно поможем ее решить.

Ну а на этом все! Удачи!

In this article, we will look into the process of installing code blocks for C++ on windows.

Installation Code Blocks for C++ on Windows:

Follow the below steps to install Code Blocks  for C++ on windows:

Step 1: Open Your Web Browser

Step 2: Go to the Search Panel and Search for “Code Blocks”

Step 3: Click on the First Result shown on the Search Engine or click on this link.

Step 4: Click on the “Downloads” Section.

Step 5: Click On “Download the binary release”.

Step 6: As per this Date, the Latest Version of Code Blocks is 20.03. Now here you’ll find several download options

  1. codeblocks-20.03-setup.exe : It is a standard executable file that is easier to install.
  2. codeblocks-20.03-nosetup.zip : It is a zip file which you do not have to install , you can just unzip and run it.

I’ll suggest you download the file with MinGW written on it (“codeblocks-20.03mingw-setup.exe”) as MinGW is a Compiler that is needed to run the Program. If you download the normal setup file then you have to download The compiler separately.

Step 7: Click on Sourceforge.net under the Download Section of your desired file. 

Step 8: then Download should begin within some seconds.

Step 9: When the download is completed, Open Your Code Blocks Setup File.

Step 10: Click on Next.

Step 11: Click on I agree.

Step 12: Click On Next ( you need to have at least 600 MB free storage on your drive for the installation).

Step 13: Select your Destination and Click on Install

Step 14: Once Installation gets completed, click on Next and then Click on Finish

Now You Code Blocks have been installed.

To Set the Environment Path of GCC compiler

Step 1: Go to your Code Blocks MinGW installation folder location ( For me it is C:Program FilesCodeBlocksMinGWbin) and copy the address

Step 2:  Go to Search Panel and type “Edit System environment variables”

Step 3: Click On Environment Variables

Step 4: Under System variables, Click on Path and Select Edit

Step 5: Click on New and Paste the Address into it and click  on OK

Now Code Blocks will automatically detect GCC Compiler.

Last Updated :
06 Oct, 2021

Like Article

Save Article

Установка и настройка в Windows

    • Вариант 1 (более корректный, но трудоемкий): установка с официального сайта

      Code::Blocks скачивается со страницы загрузки официального сайта. Рекомендуется выбрать codeblocks-20.03-setup.exe (установщик), codeblocks-20.03-setup-noadmin.exe (установщик на компьютер без административного доступа, например публичный) или codeblocks-20.03-nosetup.zip (архив, для опытных пользователей), можно скачивать с любого предложенного зеркала.

      Компилятор MinGW (сборка TDM) Также скачивается с официального сайта. Рекомендуется выбрать tdm-gcc-webdl.exe или tdm64-gcc.

      Библиотека OpenBGI скачивается с официального сайта и собирается вручную (для опытных разработчиков) или используется подготовленный К. К. Смирновым вариант — исправление библиотеки, сделанное для поддержки символов кириллицы, за что ему отдельное спасибо: установщик, архив, исходный код (для самостоятельной сборки). Установить (распаковать) нужно в ту папку, в которой установлен MinGW, например, C:Program FilesCodeBlocksMinGW,  C:TDM-GCC-64 и т.д.

    • Вариант 2 (более простой): установка подготовленного пакета

      Пакет содержит все три продукта в том виде: установщик или самораспаковывающийся архив или архив<(для опытных пользователей).

      Установщий можно использовать как для установки для всех пользователей (требуется административный доступ), так и тольво для одного пользователя

      Распаковку архивов можно проводить в любую папку, права администратора не требуется.

      Самораспаковывающийся архив запросит папку, в которую будет установлен пакет из Code::Blocks, MinGW и OpenBGI, ярлыки не создаются (требуется создать в ручную или запускать из папки установки). Пожалуйста, не пытайтесь распаковать этот архив поверх имеющейся установки программы, укажите папку, в которой подпапки CodeBlocks нет.

      На новых версиях Windows использование самораспаковывающегося архива и установщика может быть затруднено, они могут работать крайне медленно, nак как эти файлы еще не известны защитнику Windows.

Для установки на домашних компьютерах начинающим пользователям рекомендуется скачать подготовленный установщик и использовать его.

Для установки на общественных компьютерах начинающим пользователям рекомендуется скачать подготовленный самораспаковывающийся архив и использовать его (установить в свою рабочую папку).

После установки приложение готово к разработке программ на языке C из графического окружения (Code::Blocks). Компиляция с помощью MinGW-GCC и запуск получаемых приложений из командной строки может потребовать прописания в переменной окружения PATH пути к каталогу bin из связки TDM

Первый запуск

При первом запуске Code::Blocks обнаружит имеющиеся в системе компиляторы. Надо проследить, чтобы GNU GCC Compiler был установлен по умолчанию (красная строка внизу окна).

01

Если это не так, нужно найти этот компилятор в списке, кликнуть мышью и нажать кнопку Set as Default справа.

Далее программа запросит возможность ассоциации файлов исходного кода C/C++ (при открытии из проводника Windows): в этом нет необходимости (No, leave everything as it is), так как на самом деле при разработке лучше использовать проекты, а не отдельные файлы исходного кода.

Добавить комментарий