Code::Blocks Setup for Compilation

Code::Blocks is a great IDE. But the official Code::Blocks installation does come with some shortcomings that we have to address before compiling any of Eir code.

GNU GCC Static Library Dependency Fix

Static Library in Static Library support is broken (as of 17.12). To fix it we must adjust the GCC advanced compiler settings.

Click on the “Settings” menu option at the top of the main Code::Blocks window. Then select “Compiler…”.

Code::Blocks Global Compiler Settings

Go to the last tab as shown above. Then click on the “Adavanced options…” button at the bottom right of the GUI.

Code::Blocks Compiler Advanced Options (GCC)

You should see this “Advanced Compiler Options” window. Select Link object files to static library in the combo box. The command line macro should now contain the static linker build step.

Replace the existing script with this one:

rm -f $static_output
$lib_linker -r -s -T $static_output $link_objects
$lib_linker -r -c -T $static_output $link_options

When finished click OK on both the config windows. Done! Now you can specify static library dependencies in the Other linker options editbox of your projects.

Code::Blocks Other Linker Options

Paths have to be relative from the .cbp project file location.