0.6a — Build configurations

A build configuration (also called a build target) is a collection of project settings that determines how your IDE will build your project. The build configuration typically includes things like what the executable will be named, what directory the executable will be output in, what directories the IDE will look in for other code and header files, whether to keep or exclude debugging information, and how highly to have the compiler optimize your program. Generally, you will want to leave the settings at their default values unless you have a specific reason to change something.

When you create a new project in your IDE, the IDE will generally set up two different build configurations for you: a release configuration, and a debug configuration.

The debug configuration is designed to help you debug your program, and is generally the one you will use when developing your programs. This configuration turns off all optimizations, and includes debugging information, which makes your programs larger and slower, but much easier to debug. The debug configuration is usually selected as the active configuration by default.

The release configuration is designed to be used when releasing your program to the public. This version is typically optimized for size and performance, and doesn’t contain the extra debugging information.

For example, when the “Hello World” program from the previous lesson was built using Visual Studio 2013, the executable produced in the debug configuration was 65kb, whereas the executable built in the release version was 12kb.

Switching between debug and release in Visual Studio

There are multiple ways to switch between debug and release in Visual Studio. The easiest way is to find the “Solution Configurations” dropdown in the Standard Toolbar Options menu:

VS Solution Configurations Dropdown

It should be set to Debug or Release. You can change which one you’re using by selecting it in the dropdown.

You can also access the configuration manager dialog, by selecting Build->Configuration Manager, and change the “Active solution configuration”.

Switching between debug and release in Code::Blocks

In Code::Blocks, you should see a toolbar item called “Build Target”:

VS Solution Configurations Dropdown

It can be set to debug or release in the dropdown.


The build configuration holds the settings for different versions of your project. You generally won’t need to touch these settings, but you may want to switch between debug and release.

Rule: Use the debug configuration when developing your programs. When you’re ready to release your executable to others, build it using the release configuration.

0.7 -- A few common C++ problems
0.6 -- Compiling your first program

71 comments to 0.6a — Build configurations

  • Mark

    I can't find the Build target toolbar, because I am using codeblocks 17.12. Another question that is when and why do you need to use the highlight option? And last question is what are the "match case" and "use regex" options used for?

  • Willie

    Hello Alex.
    Is there a easy to read section where the variables are listed in a table form so the values can be seen and whatever else ....possibly how the variables are written?
    Trying to make it easy.

    • Alex

      I don't think I understand what you mean. Variables aren't mentioned in this lesson, so I'm not sure what problem you are trying to solve for.

  • Prynce

    Thanks so much I was able to write my first c++ program using Dev c++
    "Hello world!" Was displayed on my screen

  • Dear Sir!

    I am revising your lessons after completing the chapter 1 (including its sub-chapters).
    I have downloaded and installed Code Block-version 16.01 (Release 16.01 rev 10702 (2016-01-25 19:50:14) gcc 4.9.2 Windows/unicode - 32 bit).

    I failed to locate any 'Build target' there even after pasting my 'HellowWorld' program which otherwise runs perfectly.

    Can you please guide me in this respect?

    Thank you.

    Best regards.

    • Alex

      Did you set up both a release and debug release configuration when your project was created? Check out the screenshot here: -- it shows where you should be able to see your active build target on the interface (in this screenshot, the Debug configuration is selected)

  • Kushal Singh

    Thanks 🙂

  • Kushal Singh

    Hello Alex,

    When I navigate to Debug dir of my project folder , I find files with extensions: idb,pdb and pch. what are these files for and when are they generated ?


    • Alex

      .idb and .pdb are debug files produced by Visual Studio. .pch is a precompiled header file. These are all generated when you compile your program in debug configuration with precompiled headers enabled (which they are by default).

  • Kushal Singh

    How can I check the size of executable produced in debug/release configuration ?

    • Alex

      Use your OS file explorer/browser and find where your IDE put the executable for each of your configurations. This is most likely in a subfolder inside your project directory.

  • phong nguyen

    Hi, I just want to say thank you for the continuous efforts over the past couple of years. You rock!!!

  • Ahtazaz Khan

    Hi, i'm new here, i love your effort. i'm doing bachelor in Computer science. I have a little bit programming skills.But now i have a aim to learn Programming from the 0.I found your work best.Amazing tutorials.I have a question about building configurations.I have don't clear the build-configuration.Mean,What is the purpose of Build Configuration.How and when debug and release configurations use...?

    • Alex

      You'll generally use a debug configuration when developing your code or running it for your own purposes. This enables all debugging functionality, making it easier to find errors. If you decide to release your executable to others, you'll build it using a release configuration. This strips out all debugging information and uses more compiler optimizations, making your code smaller and faster.

      You can define custom release configurations as well, but there's no need unless you have special circumstances.

Leave a Comment

Put all code inside code tags: [code]your code here[/code]