0

When trying to use my own build of GDC-4.8-20120105 to build Hello World in D

import std.stdio;
void main(string args[])
{
  auto x = 0b10;
  writeln(x);
}

I get the following error:

per@lappis:~/alt$ gdc-4.8  ~/f.d /home/per/alt/x86_64-unknown-linux-gnu/lib64/libgphobos2.a 
/usr/lib/x86_64-linux-gnu/crt1.o(.text+0x20): error: undefined reference to 'main'
/tmp/cc8j7g1e.o:f.d:function _D1f9__modinitFZv: error: undefined reference to '_Dmodule_ref'
/tmp/cc8j7g1e.o:f.d:function _D1f9__modinitFZv: error: undefined reference to '_Dmodule_ref'
/tmp/cc8j7g1e.o:f.d:function _D1f12__ModuleInfoZ: error: undefined reference to '_D3std5stdio12__ModuleInfoZ'
...

What is wrong?

cmh
  • 10,612
  • 5
  • 30
  • 40
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
  • 1
    I'm just guessing here, but did you recompile your druntime+phobos with the new compiler too? – Adam D. Ruppe Jan 15 '13 at 13:40
  • I thought Ian's script did that automatically. I'll try building it later on. Is the name `libgphobos` just a way to differ distinguish it from libphobos if they are put in the same directory (to make GDC and DMD coexist in the same installation)? I guess I always have to compile all packages separately for DMD and GDC right? Is there a way to make DMD/GDC trace which libraries that are loaded? – Nordlöw Jan 15 '13 at 16:10
  • I don't actually know.. when I'm on the irc channel next I'll post a link to this, maybe someone else will be more help. – Adam D. Ruppe Jan 16 '13 at 14:39
  • The switch --verbose shall reveal a little more about what the compiler is doing when linking the app. – ibuclaw Jan 16 '13 at 21:32

0 Answers0