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: fu开发者_如何学编程nction expected before (), not __error of type _error_
Is the book out of date, or did something install incorrectly, or...?
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.
精彩评论