Search code examples
d

Getting started with D2 on Windows


I grabbed the "dmd D 2.0 compiler 1-click install for Windows" from http://www.digitalmars.com/d/download.html, installed, and tried to compile the hello world example from "The D Programming Language", i.e.

import std.stdio;

void main() {
    writeln("Hello, world!");
}

with "dmd hello.d", but was met with:

hello.d(4): Error: undefined identifier writeln, did you mean function writefln?
hello.d(4): Error: function expected before (), not __error of type _error_

Is the book out of date, or did something install incorrectly, or...?


Solution

  • Type 'dmd' without any arguments and see what version you're running. You seem to be using D1. The installer probably placed the path to dmd before the path to dmd2 in your environment. Check your PATH variable.