sdldsdl-2derelict3

undefined reference to opEquals: Linker errors with Derelict3 Bindings to SDL2


I am trying to write a simple hello world using the Derelict3 bindings for SDL2. I am getting errors during linking that I have not seen before.

module main;

import derelict.sdl2.sdl;

pragma(lib, "DerelictSDL2");
pragma(lib, "DerelictUtil");
pragma(lib, "dl");

int main(string[] args)
{
    DerelictSDL2.load();
    return 0;
}

command line:

dmd src/main.d -debug -Iinclude -Isrc -L-Llib -L-lSDL2

output:

> lib/libDerelictSDL2.a(sdl_55_698.o):(.rodata+0x41e8): undefined reference to `_D6object6Object8opEqualsMFC6ObjectC6ObjectZb'
> lib/libDerelictUtil.a(exception_9b_6db.o):(.rodata+0xe8): undefined
> reference to `_D6object6Object8opEqualsMFC6ObjectC6ObjectZb'
> lib/libDerelictUtil.a(exception_9d_89d.o):(.rodata+0x178): undefined
> reference to `_D6object6Object8opEqualsMFC6ObjectC6ObjectZb'
> lib/libDerelictUtil.a(exception_9e_7a5.o):(.rodata+0x118): undefined
> reference to `_D6object6Object8opEqualsMFC6ObjectC6ObjectZb' collect2:
> ld returned 1 exit status
>         --- errorlevel 1

what I have tried:

I am using DMD64 D Compiler v2.063.2. Any help is appreciated. Thanks.


Solution

  • It looks like Derelict was built using a different version of D than the one you're using to build your program. Try rebuilding Derelict from source.