Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Installation of Code::Blocks

Code::Blocks is an IDE that can be configured for use with D and Tango.

  • If you are installing on Windows: make sure to add the D lexer to the Default install, in order to get syntax coloring.

Configuration of Projects

Add "Tango" and "Posix" to versions in Build Options > Compiler settings:

  • Versions for conditional compilation in D is added under the "#defines" tab of the settings (the tab name comes from C/C++), which will automatically use the right compiler option (-version for DMD and -fversion for GDC).
  • Later versions of DMD and LDC has started pre-definining the Posix version, and will give an error if it is explicitly added. In that case, only add Tango. GDC instead pre-defines a Unix version, which is used by gPhobos.

Add "-lgtango" to other linker options of Build options > Linker settings:

  • If the imports are installed in a non-standard place, you may want to add the actual directories in the "Search Directories" tab.
  • Same may apply to the toolchain binaries, in which case the containing directory should be added to the "Toolchain Executables" tab.

Note: If GCC is used as the default linker instead of going via GDC, libgphobos will have to be added explicitly. Make sure libgphobos is listed after libgtango like this (The reason being that library order matters in linking when the underlying linker is ld):

-lgtango -lgphobos

Test the installation

The following simple program should test all of the above aspects.


void main()
    Cout("Hello world!").newline;

The "D Application" New Project wizard will use DMD's old hello.d:

version(Tango) extern (C) int printf(char *, ...);

int main(char[][] args)
    printf("hello world\n");
    printf("args.length = %d\n", args.length);
    for (int i = 0; i < args.length; i++)
	printf("args[%d] = '%s'\n", i, cast(char *)args[i]);
    return 0;