Migrating dmd to D?

Dicebot m.strashun at gmail.com
Tue Mar 12 10:06:24 PDT 2013


(copied from an e-mail)
Probably I have misunderstood linker error then. This simple 
snippet fails:

---
import core.stdc.stdio;

template Value(int val)
{
     enum Value = val;
}
// Plain enum Value = 42 works

extern(C)
int main()
{
     printf("%d", Value!42);
     return 0;
}
---
$ dmd -betterC -defaultlib= tmp.d
tmp.o: In function `_D3tmp7__arrayZ':
tmp.d:(.text._D3tmp7__arrayZ+0xd): undefined reference to 
`_D3tmp12__ModuleInfoZ'
tmp.d:(.text._D3tmp7__arrayZ+0x16): undefined reference to 
`_d_array_bounds'
tmp.o: In function `_D3tmp8__assertFiZv':
tmp.d:(.text._D3tmp8__assertFiZv+0xd): undefined reference to 
`_D3tmp12__ModuleInfoZ'
tmp.d:(.text._D3tmp8__assertFiZv+0x16): undefined reference to 
`_d_assertm'
tmp.o: In function `_D3tmp15__unittest_failFiZv':
tmp.d:(.text._D3tmp15__unittest_failFiZv+0xd): undefined 
reference to `_D3tmp12__ModuleInfoZ'
tmp.d:(.text._D3tmp15__unittest_failFiZv+0x16): undefined 
reference to `_d_unittestm'
collect2: error: ld returned 1 exit status
---

What is the issue then?


More information about the Digitalmars-d mailing list