Chuyển tới nội dung
Home » Gnu Gcc Compiler Download Code Blocks | Custom Compilers

Gnu Gcc Compiler Download Code Blocks | Custom Compilers

Fix Code Blocks Environment Error Can't find compiler executable in your configured search path

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.

Linux

At the time of this writing, Code::Blocks supports the following compilers in 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.

Fix Code Blocks Environment Error Can't find compiler executable in your configured search path
Fix Code Blocks Environment Error Can’t find compiler executable in your configured search path

Linux

At the time of this writing, Code::Blocks supports the following compilers in 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.

Linux

At the time of this writing, Code::Blocks supports the following compilers in 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.

How to Install CodeBlocks ( IDE 20.03 ) with MinGW for C and C++ Programming on Windows 11
How to Install CodeBlocks ( IDE 20.03 ) with MinGW for C and C++ Programming on Windows 11

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:

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

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

Binary releases

Please select a setup package depending on your platform:

NOTE: For older OS’es use older releases. There are releases for many OS version and platforms on the Sourceforge.net page.

NOTE: There are also more recent nightly builds available in the forums or (for Ubuntu users) in the Ubuntu PPA repository. Please note that we consider nightly builds to be stable, usually.

NOTE: We have a Changelog for 20.03, that gives you an overview over the enhancements and fixes we have put in the new release.

NOTE: The default builds are 64 bit (starting with release 20.03). We also provide 32bit builds for convenience.

Code Blocks 17.12 GNU GCC Compiler error fixed 2023 | 100% Working
Code Blocks 17.12 GNU GCC Compiler error fixed 2023 | 100% Working

How to Install GCC on Windows

We will use an open-source Integrated Development environment named Code::Blocks which bundles a compiler (named gcc offered by Free Software Foundation GNU), editor and debugger in a neat package.

Step 1) Download Binary release

Go to http://www.codeblocks.org/downloads and click Binary Release.

Step 2) Select the installer with GCC for Windows compiler

Choose the installer with GCC Compiler, e.g., codeblocks-17.12mingw-setup.exe which includes MinGW’s GNU GCC compiler download and GNU GDB debugger with Code::Blocks source files.

Step 3) Start installation

Run the downloaded installer and accept the default options for installing GCC Windows. This straightforward process ensures a seamless setup of the GCC compiler on your Windows system.

Step 4) Accept the terms and conditions

Accept the Agreement

Step 5) Keep default component selection

Keep the component selection default and click Next.

Step 6) Locate the installation path

You may change the installation folder and click Next.

Step 7) Find and double-click on the CodeBlocks icon

To launch Code::Blocks double click on the icon.

Step 8) Let it detect the compiler itself

It will detect the GCC compiler for Windows automatically, set it as default.

Associate C/C++ files with code::blocks

Step 9) Open the IDE and start using

You will see the IDE Home screen.

Install GCC on Mac

To set up a ‘C’ programming environment on MAC operating system, follow the given steps:

1. Visit the given link https://developer.apple.com/downloads/index.action for install gcc on Windows. You will need an Apple developer ID

“Command Line Tools for X-Code,” pick any version (latest version is always recommended) and download the .dmg file.

2. After the file is being downloaded on the machine, double click and follow the wizard and install the file. Always keep the default settings as suggested by the installation wizard.

3. After the installation process, open a terminal and run gcc -v command to check if everything is successfully installed.

CodeBlocks IDE Installation on Windows 10/11 [2023 Update] MinGW GCC Compiler | C & C++ Programming
CodeBlocks IDE Installation on Windows 10/11 [2023 Update] MinGW GCC Compiler | C & C++ Programming

Mac OS X

File Download from
CodeBlocks-13.12-mac.zip FossHUB or Sourceforge.net

NOTES:

  • Code::Blocks 20.03 for Mac is currently not available due to issues caused by Apple hardening their install packages and lack of Mac developers. We could use an extra Mac developer to work on these issues.
  • The provided download contains an Application Bundle (for the i386 architecture) built for Mac OS X 10.6 (and later), bundling most Code::Blocks plugins.

CodeBlocks is an open-source, cross-platform (Windows, Linux, MacOS), and free C/C++ IDE. It supports many compilers, such as GNU GCC (MinGW and Cygwin) and MS Visual C++. It supports interactive debugging (via GNU GDB or MS CDB). CodeBlocks is surprisingly versatile, and in my opinion, much better than the Visual Studio suite. The mother site of CodeBlocks is www.codeblocks.org.

How to Install CodeBlocks 13.12

Step 1: Download

Goto http://www.codeblocks.org/downloads. Click “Download the binary release”. Select your operating platform (e.g., Windows 2000/XP/Vista/7). Download the installer with GCC Compiler, e.g.,

codeblocks-13.12mingw-setup.exe

(98 MB) (which includes MinGW’s GNU GCC compiler and GNU GDB debugger).

Step 2: Install

Run the downloaded installer. Accept the default options.

Verify the Compiler’s and Debugger’s Path: (For CodeBlocks 13.12 For Windows) Goto “Settings” menu ⇒ “Compiler…” ⇒ In “Selected Compiler”, choose “GNU GCC Compiler” ⇒ Select tab “Toolchain Executables” ⇒ Check the “Compiler’s Installation Directory”. It shall be set to the “MinGW” sub-directory of the CodeBlocks installation directory, for example, suppose that CodeBlocks is installed in ”

c:\Program Files\codeblocks

“, set it to ”

c:\Program Files\codeblocks\MinGW

“.

Similarly, check the debugger’s path. Goto “Settings” menu ⇒ “Debugger…” ⇒ Expand “GDB/CDB debugger” ⇒ Select “Default” ⇒ In “Executable path”, provide the full-path name of ”

gdb.exe

“, for example, ”

c:\Program Files\codeblocks\MinGW\bin\gdb.exe

“.

Notes For CodeBlocks 13.12 For Windows (Jan 2014)

I encountered problem running debugger with CodeBlocks 13.12 bundled with MinGW (gcc v4.7.1 and gdb 7.5).

I resolved by installing the latast MinGW (gcc 4.8.1, gdb 7.6.1) separately (See “How to install MinGW”), and configured the compiler’s and debugger’s path to the installed MinGW as in the above step.

Alternatively, consider using Eclipse or Netbeans with Cygwin or MinGW GNU GCC compiler.

Writing C/C++ Programs in CodeBlocks

Read:

  1. CodeBlocks’ Wiki @ http://wiki.codeblocks.org/index.php?title=Main_Page, in particular, “Creating a new project” and “Debug my Program”.
Writing Toy Programs (without Creating a Project)

To write toy programs (such as few-line simple programming exercises):

  1. File ⇒ New ⇒ Empty File.
  2. Enter (copy and paste) the following codes:

    // First C++ program to say Hello #include

    using namespace std; int main() { cout << “Hello, world!” << endl; return 0; }

    Save the file as ”

    Hello.cpp

    ” in your project directory (e.g., ”

    d:\project

    “).

  3. Build (Compile and Link): Select “Build” menu ⇒ Build (Ctrl-F9).
  4. Run: Select “Build” menu ⇒ Run (Ctrl-F10).

The drawback is you cannot debug program without creating a project.

Read “CodeBlocks’ Common Errors” if ….

Writing Programs (under Project)

Other than the few-line toy programs, you shall create a project for each of your application. A project contains related files such as source codes, header files, and relevant resources. Also, under CodeBlocks, you can only debug your program under a project – single-file program (in previous section) debugging is not supported.

  1. File ⇒ New ⇒ Project… ⇒ Console Application ⇒ Go.
  2. The “Console Application” wizard appears:

    1. Next
    2. Select “C++” ⇒ Next.
    3. In “Project Title”, enter ”

      HelloProject

      “. In “Folder to create project in”, set to your working directory, e.g., ”

      d:\project

      “. Accept the default for the rest ⇒ Next.A project directory ”

      HelloProject

      ” will be created under ”

      d:\project

      “, with a project configuration filename of ”

      HelloProject.cbp

      “. You could later create more projects under this working directory ”

      d:\project

      “.
    4. In “Compiler” field, accept the defaults of “GNU GCC Compiler” ⇒ Finish.
  3. Under the “Management” pane ⇒ Choose “Projects” tab ⇒ Expand the project node ”

    HelloProject

    ” ⇒ Expand “Source” node ⇒ Double-click ”

    main.cpp

    “, which is a template program to say “Hello, world!”.
  4. To build the program, select “Build” menu ⇒ Build.
  5. To run the program, select “Build” menu ⇒ Run.
  6. To create more source file or header file under the project:

    1. File ⇒ New File… ⇒ Select C/C++ source or C/C++ header.
    2. C++ ⇒ Next.
    3. In “Filename with full path” ⇒ Click the “Navigate” (…) button to navigate to the project directory and enter the new file name. Check both the “Debug” and “Release” boxes (or “All”) ⇒ Finish.
Set Active Project

You can create more projects. However, the “Build” and “Run” commands are always apply to the active project, which is shown in bold. To activate a project: right-click on the project name ⇒ “Activate Project”.

Open an Existing Project

To open an existing project, either:

  1. From “File” menu ⇒ “Recent Projects” ⇒ Choose the desired project; or
  2. From “File” menu ⇒ “Open…” ⇒ Navigate to your project directory ⇒ Choose ”

    ProjectName


    .cbp

    “, where “.cbp” stands for CodeBlocks-Project.

Read “CodeBlocks’ Common Errors” if ….

Writing Many Toy Programs under ONE Project

Although a project may contain many source files, there can only be one

main()

function among all the source files. That is, you cannot keep two toy programs (each having a

main()

function) in one project (you will get the error “multiple definition of ‘main'” when you try to build the project).
You need to create one project for each toy program. This is clumsy!

Codeblock, nonetheless, allow you to add files or remove files from a project. The removed files are not deleted and remain in the folder. We could use this feature to write many toy programs under one project. The procedures are as follows:

  1. Create a C/C++ project called “ToyProgramProject” (read previous section on how to create a project). You shall get a ”

    main.cpp

    ” automatically.
  2. Write your toy program on ”

    main.cpp

    “. Build and run the program.
  3. To write another program: select “File” ⇒ “Save File as” ⇒ enter a program name such as ”

    myfirst.cpp

    “. Remove it from the project (because each project can only have one file with

    main()

    ), by right-click on ”

    myfirst


    .cpp

    ” ⇒ “remove file from project”.
  4. Continue to write your second toy program on ”

    main.cpp

    “. Build and run.
  5. Repeat Step 3 and 4 for another toy program.
  6. Suppose that you wish to run ”

    myfirst.cpp

    ” again: First remove ”

    main.cpp

    ” from the project. Right-click on the project ⇒ Add File… ⇒ Choose ”

    myfirst.cpp

    ” ⇒ Open ⇒ Check both the “Debug” and “Release” box ⇒ OK. You can now build and run the ”

    myfirst.cpp

    “.

In brief, use the “Add File” and “Remove File” to place your desired toy program file (with the

main()

function) under the active project. You can then “Build” the project and “Run” your toy program.

CodeBlocks’ Common Errors

Cannot Compile any C/C++ Program after Installing CodeBlocks

Check:

  1. You downloaded the CodeBlocks with “MinGW GNU C/C++ Compiler” (e.g., ”

    codeblocks-10.05mingw-setup.exe

    “).
  2. Goto “Settings” menu ⇒ “Compiler…” ⇒ Select tab “Toolchain Executables” ⇒ Check the “Compiler’s Installation Directory”. It shall be set to the “MinGW” sub-directory of the CodeBlocks installation directory, e.g., ”

    c:\Program Files\codeblocks\MinGW

    ” suppose that CodeBlocks is installed in ”

    c:\Program Files\codeblocks

    “.
Cannot Build or Run Program – Build/Run Buttons and Menu-Items are Grey and Not Selectable

A previous program is still running. You need to terminate the program by closing the output console window.

Error: undefined reference to `WinMain@16′

Check that you have a

main()

function in your function. Check your spelling of

main

!

(For C Programs) System Error: “xxx.exe has stopped working”

Check your

scanf()

function. You probably omitted the

'&'

before the variable name.

Debugging C/C++ Program in CodeBlocks

Able to use a graphics debugger to debug program is crucial in programming. It could save you countless of hours guessing on what went wrong.

Step 0: Write a C++ Program

Follow the steps in “Writing C++ Program (with Project)” to write the following C++ program, to be used for the debugging practice. This program computes and prints the factorial of (

=1*2*3*...*n

). The program, however, has a logical error and produce a wrong answer for

n=20

. (It outputs “The Factorial of 20 is -2102132736” – a negative number?!).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

/* * Compute the factorial of n, with n=20. * n! = 1*2*3*…*n */ #include

using namespace std; int main() { int n = 20; // To compute factorial of n int factorial = 1; // Initialize the product to 1 int i = 1; while (i <= n) { factorial = factorial * i; i++; } cout << “The Factorial of ” << n << ” is ” << factorial << endl; return 0; }

Run the program and observe the output produced:

The Factorial of 20 is -2102132736

Let’s use the graphic debugger to debug the program.

Step 1: Set an Initial Breakpoint

Set an initial breakpoint at

main()

function by clicking on the “left-margin” (right-side of the line number) of the line containing

main()

. A red circle appears indicating a breakpoint has been set at that line. A breakpoint suspends program execution for you to examine the internal states.

Step 2: Start Debugging

From “Debug” menu, select “Start (F8)”. The program begins execution but suspends its execution at the breakpoint, i.e.,

main()

. An yellow arrow (as shown in the diagram) appears and points at the

main()

, indicating this is the next statement to be executed.

Step 3: Single-Step and Watch the Variables and Outputs

Click the “Debugging Windows” button on the “Debug” toolbar and select “Watches” to enable the “Watch” pane. (You could also do it from the “Debug” menu.)

Click the “Next line” button on the “Debug” toolbar to single-step thru your program. At each of the step, you could examine the internal state of your program, such as the value of the variables (in the “Watches” pane), the outputs produced by your program (in the console), etc.

Single-stepping thru the program and watching the values of the variables and the outputs produced is the ultimate mean in debugging programs – because it is exactly how the computer runs your program!

Step 4: Breakpoint, Run-To-Cursor, Continue and Stop

As mentioned, a breakpoint suspends program execution and let you examine the internal states of the program. To set a breakpoint on a particular line, click the left-margin of that line (or select “Toggle Breakpoint (F5)” from “Debug” menu).

The “Continue” resumes the program execution, up to the next breakpoint, or till the end of the program.

Single-stepping thru a loop with a large count is time-consuming. You could set a breakpoint at the statement immediately outside the loop (e.g., Line 12 of the above program), and issue “Continue” to complete the loop.

Alternatively, you can place the cursor on a particular line, right-click and select “Run-To-Cursor” to resume execution up to this line.

The “Stop” ends the debugging session. Always terminate your current debugging session using “Stop” or “Continue” till the end of the program.

Important: I can’s stress more that mastering the use of debugger is crucial in programming. Explore the features provided by the debuggers.

Other Debugging Features

Step-Into and Step-Out: To debug a function, you need to use “Step-Into” to step into the first statement of the function. (“Step-Over” runs the function in a single step without stepping through the statements inside the function.) You could use “Step-Out” to return to the caller, anywhere within the function. Alternatively, you can set a breakpoint inside a function.

Watching a Variable: To add a variable into the “Watches” panel, goto “Debug” ⇒ “Edit Watch…” ⇒ “Add” ⇒ Enter the variable name ⇒ You can select the format, or “watch as array”.

Tips and Tweaks

  1. Re-format Source Code: Right-click on the source file ⇒ Format this file (AStyle). [Source formatting feature is provided by a plugin called AStyle, which can be accessed via menu “Plugins” ⇒ “Source Code Formatter (AStyle)”. To configure the formatting styles, goto “Settings” ⇒ “Editor…” ⇒ “Source Formatter”.]
  2. Auto-Complete: type the initial letters of a keyword/identifier and press Ctrl-space to list the available options.
  3. Abbreviation: e.g., type “for” and press control-J to get the skeleton of for-loop. The abbreviation list can be configured in “Settings” menu ⇒ “Editor…” ⇒ “Abbreviations”.
  4. Zoom in/out on Editor Panel: Either:

    1. From “Edit” menu ⇒ “Special Commands” ⇒ “Zoom” ⇒ “In”, “Out”, or “Reset”, or
    2. Hold the control key and zoom in/out via the mouse scroll wheel, or
    3. Use keyboard shortcut: control number-pad + (zoom in), control number-pad / (zoom out).
  5. Configure Editor: Right-click on the editor panel ⇒ “Configure editor…”.

    1. Source Formatter: You can choose the “Java” style.
    2. [TODO] more
  6. [How to link to API documentation?]

REFERENCES & RESOURCES

  1. CodeBlocks Mother Site @ http://www.codeblocks.org/.
  2. CodeBlocks’ Wiki @ http://wiki.codeblocks.org/index.php?title=Main_Page.
  3. CodeBlocks’ User Manual @ http://www.codeblocks.org/user-manual.

Downloads

There are different ways to download and install Code::Blocks on your computer:

  • Download the binary release

    This is the easy way for installing Code::Blocks. Download the setup file, run it on your computer and Code::Blocks will be installed, ready for you to work with it. Can’t get any easier than that!

    • Download a nightly build

      There are also more recent so-called nightly builds available in the forums. Please note that we consider nightly builds to be stable, usually, unless stated otherwise.

    • Other distributions usually follow provided by the community (big “Thank you!” for that!). If you want to provide some, make sure to announce in the forums such that we can put it on the official C::B homepage.

  • Download the source code

    If you feel comfortable building applications from source, then this is the recommend way to download Code::Blocks. Downloading the source code and building it yourself puts you in great control and also makes it easier for you to update to newer versions or, even better, create patches for bugs you may find and contributing them back to the community so everyone benefits.

  • Retrieve source code from SVN

    This option is the most flexible of all but requires a little bit more work to setup. It gives you that much more flexibility though because you get access to any bug-fixing we do at the time we do it. No need to wait for the next stable release to benefit from bug-fixes!

    Besides Code::Blocks itself, you can compile extra plugins from contributors to extend its functionality.

Thank you for your interest in downloading Code::Blocks!

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.

Install GCC Linux

Linux operating systems mostly comes with GCC preinstalled. To verify if the compiler is installed on the machine, run the following command in the terminal:

gcc –version

After executing this command if the gcc is installed on the machine then it will return the information about the compiler otherwise it will ask you to install the compiler.

To set up the ‘C’ environment on Linux distributions follow the given steps:

1. Open terminal.

2. For red-hat, Fedora users, type and execute this command

# yum groupinstall ‘Development Tools’

3. For Debian and Ubuntu users, type and execute following command

$ sudo apt-get update $ sudo apt-get install build-essential manpages-dev

4. To verify that the GCC has been successfully installed on the machine as we discussed earlier, execute the following command

gcc –version

Fix CodeBlocks Environment Error Cannot Find Compiler Executable in Your Configured Search Path
Fix CodeBlocks Environment Error Cannot Find Compiler Executable in Your Configured Search Path

Microsoft Windows

File Download from
codeblocks-20.03-setup.exe FossHUB or Sourceforge.net
codeblocks-20.03-setup-nonadmin.exe FossHUB or Sourceforge.net
codeblocks-20.03-nosetup.zip FossHUB or Sourceforge.net
codeblocks-20.03mingw-setup.exe FossHUB or Sourceforge.net
codeblocks-20.03mingw-nosetup.zip FossHUB or Sourceforge.net
codeblocks-20.03-32bit-setup.exe FossHUB or Sourceforge.net
codeblocks-20.03-32bit-setup-nonadmin.exe FossHUB or Sourceforge.net
codeblocks-20.03-32bit-nosetup.zip FossHUB or Sourceforge.net
codeblocks-20.03mingw-32bit-setup.exe FossHUB or Sourceforge.net
codeblocks-20.03mingw-32bit-nosetup.zip FossHUB or Sourceforge.net

NOTE: The codeblocks-20.03-setup.exe file includes Code::Blocks with all plugins. The codeblocks-20.03-setup-nonadmin.exe file is provided for convenience to users that do not have administrator rights on their machine(s).

NOTE: The codeblocks-20.03mingw-setup.exe file includes additionally the GCC/G++/GFortran compiler and GDB debugger from MinGW-W64 project (version 8.1.0, 32/64 bit, SEH).

NOTE: The codeblocks-20.03(mingw)-nosetup.zip files are provided for convenience to users that are allergic against installers. However, it will not allow to select plugins / features to install (it includes everything) and not create any menu shortcuts. For the “installation” you are on your own.

If unsure, please use codeblocks-20.03mingw-setup.exe!

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:

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.

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:\dev\code\cb1' 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/[email protected]/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

dm\bin\sc.ini

in a text editor, and replace the line

INCLUDE="%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE%

with

INCLUDE="%@P%\..\stlport\stlport";"%@P%\..\include";"%@P%\..\mfc\include";%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 Files\Intel\Compiler\C++\10.1.020\IA32

    , 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 Files\Microsoft Visual Studio 8\VC\bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft SDKs\Windows\v6.0\bin
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\include
C:\Program Files\Microsoft Visual Studio 8\VC\include
C:\Program Files\Microsoft SDKs\Windows\v6.0\Include
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\lib
C:\Program Files\Microsoft Visual Studio 8\VC\lib
C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib

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:\Program\DMD2\windows\lib\phobos.lib" into the "Link libraries";
   2.4). click "Search directories -> Compiler", and add "D:\Program\DMD2\src\phobos" into the field;
   2.5). click "Search directories -> Linker", and add "D:\Program\DMD2\windows\lib" into the field;
   2.6). click "Toolchain executables", add "D:\Program\DMD2\windows" 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:\Program\DMC\bin" into the field.

The “D:\Program\DMD2” or “D:\Program\DMC\bin” 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

.

How to install CodeBlocks IDE on Windows 10/11 [2024 Update] MinGW GCC Compiler | C & C++ Program
How to install CodeBlocks IDE on Windows 10/11 [2024 Update] MinGW GCC Compiler | C & C++ Program

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:

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.

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:\dev\code\cb1' 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/[email protected]/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

dm\bin\sc.ini

in a text editor, and replace the line

INCLUDE="%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE%

with

INCLUDE="%@P%\..\stlport\stlport";"%@P%\..\include";"%@P%\..\mfc\include";%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 Files\Intel\Compiler\C++\10.1.020\IA32

    , 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 Files\Microsoft Visual Studio 8\VC\bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft SDKs\Windows\v6.0\bin
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\include
C:\Program Files\Microsoft Visual Studio 8\VC\include
C:\Program Files\Microsoft SDKs\Windows\v6.0\Include
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\lib
C:\Program Files\Microsoft Visual Studio 8\VC\lib
C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib

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:\Program\DMD2\windows\lib\phobos.lib" into the "Link libraries";
   2.4). click "Search directories -> Compiler", and add "D:\Program\DMD2\src\phobos" into the field;
   2.5). click "Search directories -> Linker", and add "D:\Program\DMD2\windows\lib" into the field;
   2.6). click "Toolchain executables", add "D:\Program\DMD2\windows" 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:\Program\DMC\bin" into the field.

The “D:\Program\DMD2” or “D:\Program\DMC\bin” 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

.

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:

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.

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:\dev\code\cb1' 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/[email protected]/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

dm\bin\sc.ini

in a text editor, and replace the line

INCLUDE="%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE%

with

INCLUDE="%@P%\..\stlport\stlport";"%@P%\..\include";"%@P%\..\mfc\include";%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 Files\Intel\Compiler\C++\10.1.020\IA32

    , 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 Files\Microsoft Visual Studio 8\VC\bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft SDKs\Windows\v6.0\bin
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\include
C:\Program Files\Microsoft Visual Studio 8\VC\include
C:\Program Files\Microsoft SDKs\Windows\v6.0\Include
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\lib
C:\Program Files\Microsoft Visual Studio 8\VC\lib
C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib

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:\Program\DMD2\windows\lib\phobos.lib" into the "Link libraries";
   2.4). click "Search directories -> Compiler", and add "D:\Program\DMD2\src\phobos" into the field;
   2.5). click "Search directories -> Linker", and add "D:\Program\DMD2\windows\lib" into the field;
   2.6). click "Toolchain executables", add "D:\Program\DMD2\windows" 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:\Program\DMC\bin" into the field.

The “D:\Program\DMD2” or “D:\Program\DMC\bin” 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

.

Codeblocks - the compiler's setup (gnu gcc compiler) is invalid
Codeblocks – the compiler’s setup (gnu gcc compiler) is invalid

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.

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

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.

User Reviews

  • Thanks!
  • Es una aplicación completa, no tiene nada que envidiarle a visual studio code 🙂
  • Thanks for a great open source program
  • so goooooooooooooooooooooooood
  • Just what i want !

Downloads

There are different ways to download and install Code::Blocks on your computer:

  • Download the binary release

    This is the easy way for installing Code::Blocks. Download the setup file, run it on your computer and Code::Blocks will be installed, ready for you to work with it. Can’t get any easier than that!

    • Download a nightly build

      There are also more recent so-called nightly builds available in the forums. Please note that we consider nightly builds to be stable, usually, unless stated otherwise.

    • Other distributions usually follow provided by the community (big “Thank you!” for that!). If you want to provide some, make sure to announce in the forums such that we can put it on the official C::B homepage.

  • Download the source code

    If you feel comfortable building applications from source, then this is the recommend way to download Code::Blocks. Downloading the source code and building it yourself puts you in great control and also makes it easier for you to update to newer versions or, even better, create patches for bugs you may find and contributing them back to the community so everyone benefits.

  • Retrieve source code from SVN

    This option is the most flexible of all but requires a little bit more work to setup. It gives you that much more flexibility though because you get access to any bug-fixing we do at the time we do it. No need to wait for the next stable release to benefit from bug-fixes!

    Besides Code::Blocks itself, you can compile extra plugins from contributors to extend its functionality.

Thank you for your interest in downloading Code::Blocks!

How to Download and Install GCC Compiler in C for Windows PC

Installing MinGW Compiler for CodeBlocks
Installing MinGW Compiler for CodeBlocks

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:

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

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

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.

How to Install CodeBlocks IDE on Windows 11 with Compilers ( GCC , G++)
How to Install CodeBlocks IDE on Windows 11 with Compilers ( GCC , G++)

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.

Conclusion

‘C‘ program can be written and executed on any machine that has a suitable environment to run the program. Its recommended using an IDE or C compiler for Windows to run C programs. An IDE includes a compiler, editor and debugger. Clanfg, MinGW compiler (Minimalist GNU compiler collection for Windows), Portable ‘C’ compiler, Turbo C are popular compilers available.

Code::Blocks 20.3 hay Code Blocks / Code Block là IDE miễn phí và phổ biến cho lập trình viên C, C++ và Fortran.

Code::Blocks là gì?

Mặc dù Code Block là IDE khá phổ biến nhưng không phải ai cũng biết đến nó. Code Blocks được coi là môi trường lập trình tích hợp (IDE – Integrated Development Environment) miễn phí, đơn giản và hiệu quả, đặc biệt là cho lập trình viên mới vào nghề. Code::Blocks có thể đáp ứng được nhu cầu lập trình cơ bản của người dùng ngôn ngữ C, C++ hay Fortran. Code Block được thiết kế với khả năng mở rộng và cấu hình toàn diện.

Giống như nhiều IDE khác, Code Blocks cung cấp cho bạn môi trường tích hợp bao gồm nhiều công cụ lập trình như chương trình viết mã lệnh (Code Editor), chương trình sửa lỗi (Debugger), chương trình mô phỏng ứng dụng (Simulator)… Nói 1 cách đơn giản hơn, Code Block là phần mềm bao gồm nhiều gói phần mềm khác để phát triển phần mềm, ứng dụng đa nền tảng.

Code::Blocks sở hữu giao diện đơn giản, đa tính năng và hỗ trợ đa nền tảng. Được xây dựng dựa trên nền tảng plug-in, CodeBlocks có thể mở rộng tính năng khi cài thêm plug-in. Chẳng hạn như tính năng sửa lỗi trên Code::Blocks được cung cấp thông qua chương trình mở rộng.

Tính năng chính của Code::Blocks

Tính năng nổi bật:

Sử dụng Open Source! GPLv3 hoàn toàn miễn phí, không chi phí ẩn.

Hỗ trợ đa nền tảng.

Viết trên nền C++. Không cần lib hay diễn giải ngôn ngữ.

Mở rộng tính năng thông qua plug-in.

Compiler:

Hỗ trợ nhiều Compiler như:

GCC (MingW / GNU GCC)

MSVC++

Clang

Digital Mars

Borland C++ 5.5

Open Watcom

Hệ thống build cực nhanh (không cần makefiles).

Hỗ trợ build song song (tận dụng CPU đa lõi).

Quản lý nhiều project đa mục tiêu.

Môi trường lập trình để kết hợp nhiều project lại với nhau.

Inter-project phụ thuộc workspace.

Nhập MSVC project và workspace (không hỗ trợ Assembly Code).

Nhập Dev-C++ project.

Debugger:

Giao diện GNU GDB.

Hỗ trợ thêm MS CDB (giới hạn tính năng).

Hỗ trợ điểm ngắt (breakpoint) toàn diện:

Code breakpoints

Data breakpoints (đọc, viết và đọc/viết)

Breakpoint conditions (chỉ ngắt khi giá trị là True).

Breakpoint ignore counts (chỉ ngắt sau số lần nhất định).

Hiển thị biểu tượng và lập luận cho chức năng nội bộ.

Hỗ trợ hiển thị hướng người dùng.

Hỗ trợ Call stack.

Disassembly.

Hủy bộ nhớ tùy chỉnh.

Chuyển giữa các thread.

Xem CPU register.

Giao diện:

Đánh dấu syntax, tùy chỉnh và mở rộng.

Code folding cho C, C++, Fortran, XML và nhiều tập tin khác.

Giao diện dạng tab tiện lợi.

Hoàn thiện code,

Class Browser.

Thụt lề thông minh.

Chuyển 1 phím giữa file .h và .c/.cpp.

Mở danh sách file để chuyển nhanh giữa các file (tùy chọn).

Bộ công cụ tùy chỉnh.

Quản lý danh sách to-do của nhiều người dùng.

Và nhiều tính năng khác thông qua plug-in.

Tải Code::Blocks mới nhất

Code::Blocks 20.03

Thay đổi giao diện người dùng:

UI: Thêm thông tin về thư viện wxWidgets đang được sử dụng trong hộp thoại Help -> About.

Sửa hai xác nhận do sử dụng sai wxALIGN_LEFT khi mở hộp thoại Project -> Properties,

Thêm ghi nhật ký thời gian thực hiện vào các vị trí khác nhau trong code.

Thêm ID trình biên dịch vào hộp thoại Help -> About.

Tạo trình quản lý Plugin để kiểm soát thông tin plugin có thể thay đổi kích thước.

Sửa lỗi hỏng Thanh công cụ khi lưu phối cảnh.

Khắc phục sự cố với bản dựng hàng loạt trên Linux bằng cách di chuyển quá trình xây dựng ra khỏi OnInit() khi sử dụng wx>=30.

Cải thiện vị trí cửa sổ con.

Đảm bảo nhấn thoát hoạt động chính xác trong hộp thoại Reorder targets.

Sửa phần gốc của các hộp thoại con khác nhau trong Build -> Properties.

Khắc phục xác nhận có thể xảy ra khi lựa chọn ngôn ngữ không hợp lệ.

Nhấn Escape trong hộp thoại “Code Refactoring” để đóng nó.

Điều chỉnh đường viền cho hộp thoại Find/Replace.

Sửa lỗi thanh công cụ bị hỏng khi lưu phối cảnh.

Và rất nhiều lỗi khác đã được sửa trong bản cập nhật Code::Blocks 20.03.

Code::Blocks 17.12

SDK

Sửa lỗi bản build với boost mới nhất trong autotools.

Chặn gửi EVT_MOUSE_CAPTURE_LOST trong khi mở menu ngữ cảnh ở wxScintilla.

Cho phép người dùng loại bỏ file cấu hình cũ bị lỗi khi tải.

Thông báo lỗi khi đọc file xml với tinyxml.

Sửa lỗi khi đọc file cấu hình bị cắt ngắn.

Giao diện/Core

Loại bỏ mở rộng quảng cáo khi lưu file mới được tạo trên wxGTK.

Sửa lỗi thanh trạng thái khi cuộn trình chỉnh sửa.

Đảm bảo các mục menu trong Project được vô hiệu hóa chính xác.

Thông báo cho người dùng đang chạy trình biên dịch khi thoát và hỏi xem họ có muốn dừng nó không.

Đảm bảo các mục trong menu ngữ cảnh ở tab Projects được kích hoạt/vô hiệu hóa chính xác.

Hoàn thiện code

Sửa lỗi điều khiển call tip.

Sửa lỗi chính tả trong bảng cài đặt.

Có thể cấu hình kích thước các điều khiển thanh công cụ trong bảng cài đặt.

Sửa lỗi danh sách Code Completion bị ẩn sau khi hiện.

A free C, C++ and Fortran IDE

GCC for 32-bit and 64-bit Windows with a real installer & updater

x64 build of GCC for Windows

Pokémon Save File Editor

VHDL 2008/93/87 simulator

A free and open development kit for the Sega Mega Drive

A fast compiler cache

Client library for using AWS IoT Jobs service on embedded devices

A fast, portable, simple, and free C/C++ IDE

AWS library to sign AWS HTTP requests with Signature Version 4

Client library for using AWS IoT Fleet Provisioning service

Client library for using AWS IoT Defender service on embedded devices

A complete runtime environment for gcc

CI maintained precompiled GCC ARM/ARM64 Toolchains for Raspberry Pi

Mariko’s GCC for the x68000

Unix Tools For Windows

A Forth compiler with a little difference

Library Advanced Financial Mathematics GCC (C++)

A free COBOL compiler

Open Source C & C++ IDE for Windows

C2 shellcode generator/compiler/handler

WinLibs standalone build of GCC and MinGW-w64 for Windows

Library CONIO GCC C++ for Windows e Linux (POSIX)

EMX compiler hosted on Win32

How to use CodeBlocks for C/C++ Programming | The Complete Guide 2021
How to use CodeBlocks for C/C++ Programming | The Complete Guide 2021

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.

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

các bác cho em hỏi là khi em chạy code block thì nó hiện cái dòng

Can’t file compiler executable in your configured search path’s for GNU GCC Compiler

làm sao để khắc phục ạ?

các bác cho em hỏi là khi em chạy code block thì nó hiện cái dòng

Can’t file compiler executable in your configured search path’s for GNU GCC Compiler

làm sao để khắc phục ạ?

Có thể bạn cài thiếu trình dịch, down bản có kèm trình dịch về là ổnlink downhttp://www.codeblocks.org/downloads/26bạn chọn cái codeblocks-13.12mingw-setup.exe nhá, chắc trước là bạn chọn link codeblocks-13.12-setup.exe nên không có trình dịch rồi.

nếu vẫn không được thì bạn tải lại code::block theo video sau : Video Ngôn Ngữ C – 02 – Sử dụng CodeBlocks để tạo Project C

Chúc bạn thành công

đúng rồi ạ, trước đó em có tải bản setup.exe :s

rất cảm ơn bác, em đã xóa hết tất cả code block rồi cài được rồi ạ :3

EM cũng làm giống bác rồi mà không được. Em tải cái bản bác nói rồi

Thông thường tải bản cài đặt này là lúc cài nó tự cài và có thể dùng được luôn .Lỗi ở trên là có vấn đề với đường dẫn tới trình biên dịch GNU GCC Compiler bạn có khắc phục theo các bước đơn giản sau:

http://s16.postimg.org/kmskd2i9x/Capture.jpg

3 . Chuyển sang tab Toolchain executables , chọn đường dẫn tới folder MinGW và đảm bảo các thông số ở dưới cũng được sét đặt như hình dưới đây (Windows OS)

http://s9.postimg.org/wgm2m0vdr/Capture.jpg

4 . OK

cám ơn bạn tôi sẽ làm

Cám ơn bác nhiều nhé!!!Hạnh phúc quá

bạn kien8995 cho mình hỏi mình sửa lỗi rồi nhưng sáng nay code thì lại không được. nó thế này nè đây là project mặc định tạo ra nó có sẵn. Cứu cứu

nó báo lỗi thiếu file hay đường dẫn gì trong \Program Files kia ? bạn kéo ra cho mình xem lỗi coi

teamview được không bạn

tk : 262 803 894pass: a157td

mình đang cài teamview đợi chút.Ở trên thanh công cụ bạn thử chuyển từ chế độ debug sang release xem

problem has solved !

dạ, Ai rảnh thì cài em code blocks cái. Cái nào cũng được. HUHU. Mò mãi ko ra. nick teamviemer của em: tk 171 743 727mk : 3247. Em cảm ơn

em đã thử làm theo hướng dẫn trên, nhưng khi tìm trong thư mục thì lại không tìm thấy MinGW. Em đã thử xoá hết cài lại nó vẫn vậy

sao bạn ko cài visual studio ấy

tớ đang dùng code block nên tìm hiểu về nó

cho mình ?mình chạy chương trình hello world r. nhưng k biết ấn vào nút nào mà bị tnay. và cách xử lý thế nào

Em đang học về C mà cài đặt codeblock, nhưng cứ bấm build and run thì nó hiện ra dòng chữ là có vấn đề này ạ.Em rất mong nhận được lời tư vấn của mọi người .Em cảm ơn ạ

Code::Blocks is a free, open-source, cross-platform C, C++ and Fortran IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable.Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms.Built around a plugin framework, Code::Blocks can be extended with plugins. Any kind of functionality can be added by installing/coding a plugin. For instance, compiling and debugging functionality is already provided by plugins!We hope you enjoy using Code::Blocks!The Code::Blocks Team

Features

  • Cross-platform
  • IDE
  • Compiler
  • Debugger
  • C,C++,Fortran

License

GNU Library or Lesser General Public License version 3.0 (LGPLv3)

Follow Code::Blocks

Other Useful Business Software

Opera GX is a special version of the Opera browser built specifically for gamers. The browser includes unique features like CPU, RAM and Network limiters to help you get the most out of both gaming and browsing.

Rate This Project

Login To Rate This Project

How to Install CodeBlocks IDE on Mac | Install CodeBlocks IDE on macOS (2024)
How to Install CodeBlocks IDE on Mac | Install CodeBlocks IDE on macOS (2024)

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:

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

Linux

At the time of this writing, Code::Blocks supports the following compilers in 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.

How to install MingGW w64 on Windows 11 64bit
How to install MingGW w64 on Windows 11 64bit

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:

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

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:

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.

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:\dev\code\cb1' 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/[email protected]/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

dm\bin\sc.ini

in a text editor, and replace the line

INCLUDE="%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE%

with

INCLUDE="%@P%\..\stlport\stlport";"%@P%\..\include";"%@P%\..\mfc\include";%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 Files\Intel\Compiler\C++\10.1.020\IA32

    , 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 Files\Microsoft Visual Studio 8\VC\bin
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
C:\Program Files\Microsoft SDKs\Windows\v6.0\bin
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\include
C:\Program Files\Microsoft Visual Studio 8\VC\include
C:\Program Files\Microsoft SDKs\Windows\v6.0\Include
  • 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 Files\Intel\Compiler\C++\10.1.020\IA32\lib
C:\Program Files\Microsoft Visual Studio 8\VC\lib
C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib

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:\Program\DMD2\windows\lib\phobos.lib" into the "Link libraries";
   2.4). click "Search directories -> Compiler", and add "D:\Program\DMD2\src\phobos" into the field;
   2.5). click "Search directories -> Linker", and add "D:\Program\DMD2\windows\lib" into the field;
   2.6). click "Toolchain executables", add "D:\Program\DMD2\windows" 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:\Program\DMC\bin" into the field.

The “D:\Program\DMD2” or “D:\Program\DMC\bin” 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

.

How to Download and Install C Cpp Toolset ( gcc g++ gdb ) in Windows 11  using mingw-w64 and msys2
How to Download and Install C Cpp Toolset ( gcc g++ gdb ) in Windows 11 using mingw-w64 and msys2

Linux 32 and 64-bit

Distro File Download from
codeblocks_20.03_amd64_oldstable.tar.xz FossHUB or Sourceforge.net
codeblocks_20.03_i386_oldstable.tar.xz FossHUB or Sourceforge.net
codeblocks_20.03_amd64_stable.tar.xz FossHUB or Sourceforge.net
codeblocks_20.03_i386_stable.tar.xz FossHUB or Sourceforge.net
codeblocks-20.03-1.el6.rmps.tar FossHUB or Sourceforge.net
codeblocks-20.03-1.el7.rmps.tar FossHUB or Sourceforge.net
For Ubuntu, use this PPA

Note: The Linux packages above are compressed archives (tar, tar.xz or tar.bz2). When you decompress the package you downloaded on your system, you will find all the .rpm or .deb packages required to install Code::Blocks.

Note: On RedHat/CentOS older revisions of 6 (up to 6.2 as far as we know) you need to add repoforge (former rpmforge) to your repolist, to be able to install the needed wxGTK-package. See https://repoforge.org/use for an instruction.

Note: Redhat/CentOS probably also needs an installed hunspell-package, if you want to install the contrib-plugins.

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.

How to Install C/C++ Compiler on Windows 11 - MinGW GCC
How to Install C/C++ Compiler on Windows 11 – MinGW GCC

Keywords searched by users: gnu gcc compiler download code blocks

How To Download And Install Gcc Compiler In C For Windows Pc
How To Download And Install Gcc Compiler In C For Windows Pc
Code Block 17.12 Ide Của C++
Code Block 17.12 Ide Của C++
Code::Blocks Download | Sourceforge.Net
Code::Blocks Download | Sourceforge.Net
How To Install Codeblocks ( Ide 20.03 ) With Mingw For C And C++  Programming On Windows 11 - Youtube
How To Install Codeblocks ( Ide 20.03 ) With Mingw For C And C++ Programming On Windows 11 – Youtube
Fix Code Blocks Environment Error Can'T Find Compiler Executable In Your  Search Path - Youtube
Fix Code Blocks Environment Error Can’T Find Compiler Executable In Your Search Path – Youtube
How To Download And Install Code Blocks |Gnu Gcc Compiler| By Bhanu Priya |  - Youtube
How To Download And Install Code Blocks |Gnu Gcc Compiler| By Bhanu Priya | – Youtube
Mingw Installation - Code::Blocks
Mingw Installation – Code::Blocks
How To Setup Compiler In Codeblocks (Can'T Find File Executable In Your  Configured Search Path) - Youtube
How To Setup Compiler In Codeblocks (Can’T Find File Executable In Your Configured Search Path) – Youtube
Install Code::Blocks On Linux | Flathub
Install Code::Blocks On Linux | Flathub
Mingw Installation - Code::Blocks
Mingw Installation – Code::Blocks
Download And Install Code::Blocks Ide Saurabh Shukla Sir - Mysirg
Download And Install Code::Blocks Ide Saurabh Shukla Sir – Mysirg
Lỗi Khi Compile Bằng Codeblocks - Programming - Dạy Nhau Học
Lỗi Khi Compile Bằng Codeblocks – Programming – Dạy Nhau Học
Hướng Dẫn Cài Đặt Và Sử Dụng Code::Blocks Cho Người Mới Bắt Đầu
Hướng Dẫn Cài Đặt Và Sử Dụng Code::Blocks Cho Người Mới Bắt Đầu
Installing Codeblocks
Installing Codeblocks

See more here: kientrucannam.vn

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *