Building a Project

CodeBlocks has a built-in dependency manager, so it is not necessary for a user to write a makefile to use GCC.


To Build the current project, invoke Project->Build (Ctrl-F9). This will only build any files which have been changed, or a file which directly or indirectly includes another file that has been changed.


Invoke Project->Rebuild if you want to rebuild all the files for whatever reason.


You can also build all the projects in a workspace, or rebuild all the projects in a workspace, using the menu actions under the Project menu.

Warning and Error Messages

If the compiler generates any warning or error messages during the build process, these are gathered in the Build Message window. Double-clicking on a message brings the editor’s focus to the offending line.


NOTE: If building a file generates a lot of error messages, usually only the first 2 or 3 errors are important, as the subsequent ones are usually cascading errors.


IMPORTANT: only the messages in the Build Message window are double-clickable. The Build Log window also has the error and warning messages but double clicking on that window will not jump to the editor.

Output File Memory Usage

If you are using V9.04.00 or a newer version of JumpStart C++ for Cortex and you use one of the wizards to generate a skeletal project, a command is added to the project file such that the memory sizes of the output file are summarized. This is a sample of the Message Log status window tab:


ELF file output size

Code size:        19428 bytes starting at 0x08000000

SRAM data:         2060 bytes starting at 0x20000000

Heap and Stack:    6148 bytes heap starts 0x2000080C stack starts 0x20002010


The sizes are shown in decimals. This shows at a glance how much memory is used.


If you are writing a project from scratch and not using the wizards, or if you have an existing project created prior to version 9.04, you can add this command to Project->Build options…->Build Target tab, in the Commands after build box as the last entry:


cmd /c ""$(TARGET_COMPILER_DIR)\bin\arm-none-eabi-size" -A -x "${TARGET_OUTPUT_DIR}${TARGET_OUTPUT_BASENAME}.elf" | "$(IMAGECRAFT_DIR)\bin\elfsize""


Note that it must be entered as a single line with the multiple quote " characters as shown.