Linking fails on Hello World?!

qwesx noreply at mydomain.org
Thu Mar 25 08:02:24 PDT 2010


Hello!

I just installed LDC on Debian from the repository and tried out to compile a simple Hello World program:
> import tango.io.Stdout;
> int main(char[][] argv) {
>   Stdout("Hello world!");
>   return 0;
> }

Looks simlpe enough, but when running "ldc main.d" the following error is printed:
> main.o: In function `_Dmain':
> main:(.text+0x2a): undefined reference to `_D5tango2io6Stdout6StdoutC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput'
> main:(.text+0x41): undefined reference to `_D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput5printMFYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput'
> main.o:(.rodata+0x18): undefined reference to `_D5tango2io6Stdout8__ModuleZ'
collect2: ld returned 1 exit status
> Error: linking failed:
> status: 1

The files /usr/include/d/tango/io/Stdout.d, /usr/lib/d/libtango-base-ldc.a and /usr/lib/d/libtango-user-ldc.a exist and are readable. I don't know if that's important though.

What's wrong here?
Is it my fault?
How can I fix it?

Thanks for your time :)



More information about the Digitalmars-d mailing list