Getting started with D

Step 1. Install the compiler

Head to and get the latest version of the reference compiler, DMD. There is also LDC, also very good D toolchain, but it can be a bit messier to install. DMD comes with an installer app that does everything for you.

Step 2. Create a new project

Create an empty directory for your project, open up the terminal window and type the following:

dub init
dub build
Edit source/app.d to start your project.

Step 3. Install Atom and ide-dlang

My editor of choice for D is Atom. Why? Because it is minimalistic, beautiful, customizable and extendable. It requires a lot less initial configuration for a comfortable work that any other editor I’ve seen. There is an excellent D integration plugin for Atom, ide-dlang.

import std.stdio;void main()
writeln("Edit source/app.d to start your project.");

Step 4. Create a build configuration

If you don’t like switching between editor and terminal window, you can install build package to compile your project directly from Atom. Create an .atom-build.jsonfile in the project directory with the following content:

"cmd": "dub",
"args": ["run"],
"cwd": "{PROJECT_PATH}"
Atom with D tools

Step 5. Add dependencies

As I mentioned earlier, DUB is a package manager. It has a registry with hundreds of libraries and programs that you can install with one command, dub add :

dub add dlib
import std.stdio;
import dlib;
void main()
auto img = loadPNG("image.png");
Decoding PNG with dlib

What next?



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store