Linker error

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 10 05:52:05 PDT 2016


On Friday, 10 June 2016 at 12:12:17 UTC, ketmar wrote:
> On Friday, 10 June 2016 at 12:04:50 UTC, Chris wrote:
>> I get the error below with code like this:
>>
>> auto res = ['1', '2'].map!(a => a.to!string);
>>
>> dmd 2.071.0
>>
>> What's wrong here? I import std.algorithm, std.range, 
>> std.array, std.conv in the module.
>>
>> (.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10): undefined reference to `_D64TypeInfo_C3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ'
>> collect2: error: ld returned 1 exit status
>
> post the whole code and command line, please.
>
> it looks like you doing separate compilation, and forgot to put 
> something to command line, or there is some conflict between 
> installed compiler versions (for example, dmd and ldc, and one 
> somehow is trying to use libphobos from another).

The whole code would be too much.

This, however compiles and links perfectly well:
`
import std.algorithm;
import std.conv : to;

void main()
{
   auto res = [1, 2, 3].map!(a => a.to!string);
}
`

I use dub and `dvm use 2.071.0`. The code compiled perfectly well 
until I used `map!` I have no clue what causes it. I even used 
`dub clean`


More information about the Digitalmars-d-learn mailing list