Setting up
Last updated
Last updated
This tutorial uses Windows 10 but you should be fine with another OS you are familiar with, assuming you know the equivalent commands in your system’s shell terminal. We will be using the terminal or command window a lot. The code was originally written in a Linux system then ported to Windows for this tutorial as majority of developers prefer Windows. Linux users easily follow Windows tutorials anyway, which means Linux users are or were Windows users too.
D is a language that compiles to native code. The Vibe.d framework is essentially a set of libraries written in D, which means your code needs to be linked to those libraries and compiled into a native executable. So we need at least a D compiler and a text editor.
Regarding compilers, there are three choices: DMD, GDC and LDC. It is advised that, for development purposes, we use the DMD compiler for its speed of compilation. When we are ready to deploy the final production version, we use one of the other compilers (GDC or LDC) for the runtime speed and optimizations of the binary output. This tutorial uses the DMD compiler so download and install the compiler by heading to
and click on the ‘Download Windows Installer’ button or the one appropriate for your system.
After the installation in Windows 10, you should have new entries in your start menu.
But even if you don’t, just open a terminal or command window.
To test the installation of the DMD compiler, type dmd on the terminal window. If the installation is successful, it will fill the window with help information, like this:
And a lot of other messages.
Here are two DMD options you may find helpful:
dmd --help will display the same information.
dmd --version will show you just the DMD compiler version.
The DMD installer comes with the dub package manager. It is the default package manager for D projects and was written by the creator of the Vibe.d framework himself.
To test dub, simply type in your terminal
dub
If you see a message complaining there is no project manifest, you are good.
Another way to test is to type
dub help
or
dub -h
or
dub --help
These will show the dub help information.
To show just the version number, type
dub --version
After the compiler is installed, the next thing we need is a text editor or IDE. You can stick with your favorite IDE/text editor while following this book, but this book will use the ubiquitous and free Visual Studio Code with versions for Windows, MacOS and Linux. If you haven't installed this yet, head to
https://code.visualstudio.com/download
and choose the installer appropriate for your system. After downloading, run the downloaded file and follow the instructions.
After installation, add the D language extension to VS Code so it can recognize D language code.
Add the D Programming Language (d-code) extension. With this pack, you will have features like syntax highlighting, code-completion and some error flagging.
Now you are ready to build web apps in Vibe.d.