Simple program fails to link - what am I doing wrong?

Mike Hearn mike at plan99.net
Thu Nov 12 09:22:56 PST 2009


I have a feeling this is a real simple problem. What does _D4test7MyClass1bMFZv demangle to?

class MyClass {
  int a;
  void b();
}


int main() {
  MyClass c;
  return 0;
}

$ dmd -v -run test.d
parse     test
importall test
import    object	(/home/hearn/d/dmd2/linux/bin/../../src/druntime/import/object.di)
semantic  test
semantic2 test
semantic3 test
code      test
function  main
gcc test.o -o test -m32 -Xlinker -L/home/hearn/d/dmd2/linux/bin/../lib -lphobos2 -lpthread -lm 
test.o:(.rodata+0x34): undefined reference to `_D4test7MyClass1bMFZv'
collect2: ld returned 1 exit status
--- errorlevel 1




More information about the Digitalmars-d mailing list