2

I'm trying to get the hello, world program from D (The Programming Language)/d2/Hello, World! to work on codepad.org. Here's my code:

/* This program prints a
   hello world message
   to the console.  */

import std.stdio;

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

Here's the output I get when I run it at http://codepad.org/MdLVQEMm:

Line 9: Error: undefined identifier writeln
Line 9: Error: function expected before (), not writeln of type int

Any ideas as to what I'm doing wrong? I pretty much just copy / pasted the code..

neubert
  • 15,947
  • 24
  • 120
  • 212
  • Have you tried another environment? I don't know D, but this sounds like a dumb caching error. If you were using an IDE, it's tell you to clear its cache. Maybe clear the browser cache? – Carcigenicate Jul 08 '17 at 23:10
  • 2
    That code works on [IDEone.com](http://ideone.com/kC9wgS). Do you specifically need to use codepad.org or can you just use a different compiler? – LinkBerest Jul 08 '17 at 23:13
  • I confirm the code is correct, the issue is specific to codepad.org – cym13 Jul 08 '17 at 23:24
  • @JGreenwell - that helps - thanks! – neubert Jul 09 '17 at 00:44

2 Answers2

4

From their about page, codepad.org uses D version 1.026, which was released in 2008. For reference, the current version is 2.074.1.

It's unlikely that modern D code will work with such an old version of D, especially after a major version bump. You'll have to use a different service with updated tools.

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85
3

Use https://run.dlang.io for an online editor backed by an up-to-date compiler.

Alexander Malakhov
  • 3,383
  • 2
  • 33
  • 58
Andrei Alexandrescu
  • 3,214
  • 19
  • 17