Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Not able to compile phobos code after installing Tango

Moderators: larsivi kris

Posted: 07/25/09 10:59:22

Hi there everyone, I'm absolutely new to D (comming form Java), I'd like to ask something which I'm not sure if it's been answered before. After installing Tango on my Ubuntu box (both 32 and 64 bit) I can't compile even the simplest program which uses the Phobos library. eg:

import std.stdio;

void main() {
  writef("Hello");
}

when I try to compile that with gdc main.d -o main -fversion=Posix it produces the following error

/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/utf.d:49: Error: identifier 'Error' is not defined
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/utf.d:49: Error: Error is used as a type
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/utf.d:49: class std.utf.UtfError base type must be class or interface, not void
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/array.d:6: Error: identifier 'Error' is not defined
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/array.d:6: Error: Error is used as a type
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/array.d:6: class std.array.ArrayBoundsError base type must be class or interface, not void
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:818: Error: identifier 'string' is not defined
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:818: Error: string is used as a type
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:818: Error: identifier 'string' is not defined
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:818: Error: string is used as a type
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:818: Error: cannot have parameter of type void
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:894: Error: identifier 'string' is not defined
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:894: Error: string is used as a type
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:894: Error: identifier 'string' is not defined
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:894: Error: string is used as a type
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/string.d:894: Error: cannot have parameter of type void
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/format.d:75: Error: identifier 'Error' is not defined
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/format.d:75: Error: Error is used as a type
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../include/d/4.2.4/std/format.d:75: class std.format.FormatError base type must be class or interface, not void

Is that due to the Phobos - Tango incompatibility issue or may it be something else?.

Author Message

Posted: 07/25/09 13:25:24

After installing Tango on my Ubuntu box (both 32 and 64 bit) I can't compile even the simplest program which uses the Phobos library.

Yep. :)

Tango works by replacing Phobos. When Tango was first being developed (and even before, when one of its predecessors, Ares, was still around), the compiler was basically hard-coded to use Phobos, and you could only get Tango to work by tricking the compiler into thinking that it was Phobos. Since then, the situation has improved, since the compiler now provides switches to select which runtime library it should use. However the split between Phobos and Tango still exists at a fundamental level - the runtime library - and that won't change with D1, as far as anyone can tell.

With D2, the situation is/will be somewhat different. Tango's runtime has been separated out into DRuntime, on which Phobos2 - D2's standard library - is now based. The idea is that you'll be able to use both Phobos and Tango together, although Tango hasn't yet been ported to D2. D2's still a quickly-moving target, and porting a codebase as large as Tango over now would probably result in far more frustration than it's worth.

But the situation with D1 isn't hopeless; there is something called Tangobos, which is basically a port of Phobos that runs on top of Tango's runtime. It's almost identical, with some minor differences in the lower-level modules.

TL;DR: this is as expected. If you want to use both Tango and Phobos at the same time in D1, you'll have to use Tangobos.

I don't know why I'd make a new scripting language. I mean, I might as well just draw some lines in the sand with a stick.

Posted: 07/25/09 15:43:52

A million thanks, I was just confused; I think I'll stick with Tango since I have bought the book "Learn to Tango with D" :), which I hope will help me to get some 3D coding done as well as a new girlfriend ;) .