digitalmars.D - Linking fails on Hello World?!
- qwesx (9/20) Mar 25 2010 Looks simlpe enough, but when running "ldc main.d" the following error i...
- Robert Clipsham (6/26) Mar 25 2010 Try this:
- qwesx (5/11) Mar 25 2010 Thank you very much, it works now.
- Robert Clipsham (8/19) Mar 25 2010 The line won't be in there by default, as the tango user library isn't
- Moritz Warning (3/20) Mar 25 2010 Hi,
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 statusError: linking failed: status: 1The 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 :)
Mar 25 2010
On 25/03/10 15:02, qwesx wrote:Hello! I just installed LDC on Debian from the repository and tried out to compile a simple Hello World program:Try this: $ ldc -L-L/usr/lib/d -L-ltango-base-ldc -L-ltango-user-ldc main.d If that works you need to make sure these -L's are included in yout ldc.conf (I'm not sure where this is in the debian packages, probably /etc/ldc.conf, /etc/ldc/ldc.conf or /usr/bin/ldc.conf).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 statusError: linking failed: status: 1The 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 :)
Mar 25 2010
Robert Clipsham Wrote:Try this: $ ldc -L-L/usr/lib/d -L-ltango-base-ldc -L-ltango-user-ldc main.d If that works you need to make sure these -L's are included in yout ldc.conf (I'm not sure where this is in the debian packages, probably /etc/ldc.conf, /etc/ldc/ldc.conf or /usr/bin/ldc.conf).Thank you very much, it works now. -L-L/usr/lib/d and -L-ltango-base-ldc were already in the /etc/ldc.conf, but -L-ltango-user-ldc was missing. As I am pretty new to D, is it reasonable that this line was missing or is it worth a bug-report? Thank you very much!
Mar 25 2010
On 25/03/10 15:34, qwesx wrote:Robert Clipsham Wrote:The line won't be in there by default, as the tango user library isn't required to write your applications, only the runtime is. If you'd like to report a bug it should be to the packagers to see if they can automatically add in the user library to the configuration file when you install it. I'll add a note to http://dsource.org/projects/ldc/wiki/BuildInstructionsUbuntu for future users in case anyone else has the problem.Try this: $ ldc -L-L/usr/lib/d -L-ltango-base-ldc -L-ltango-user-ldc main.d If that works you need to make sure these -L's are included in yout ldc.conf (I'm not sure where this is in the debian packages, probably /etc/ldc.conf, /etc/ldc/ldc.conf or /usr/bin/ldc.conf).Thank you very much, it works now. -L-L/usr/lib/d and -L-ltango-base-ldc were already in the /etc/ldc.conf, but -L-ltango-user-ldc was missing. As I am pretty new to D, is it reasonable that this line was missing or is it worth a bug-report? Thank you very much!
Mar 25 2010
On Thu, 25 Mar 2010 11:34:15 -0400, qwesx wrote:Robert Clipsham Wrote:Hi, I've found the bug yesterday and wrote to ldc packages.debian.org already.Try this: $ ldc -L-L/usr/lib/d -L-ltango-base-ldc -L-ltango-user-ldc main.d If that works you need to make sure these -L's are included in yout ldc.conf (I'm not sure where this is in the debian packages, probably /etc/ldc.conf, /etc/ldc/ldc.conf or /usr/bin/ldc.conf).Thank you very much, it works now. -L-L/usr/lib/d and -L-ltango-base-ldc were already in the /etc/ldc.conf, but -L-ltango-user-ldc was missing. As I am pretty new to D, is it reasonable that this line was missing or is it worth a bug-report? Thank you very much!
Mar 25 2010