why is my dsfml code not compiling through dub

245 views Asked by At

I tried to compile dsfml using dub by i keep getting this error:

Linking...
/usr/bin/ld: cannot find -ldsfml-window
/usr/bin/ld: cannot find -ldsfml-system
/usr/bin/ld: cannot find -ldsfml-audio
/usr/bin/ld: cannot find -ldsfml-network
/usr/bin/ld: cannot find -ldsfml-graphics
collect2: error: ld returned 1 exit status
--- errorlevel 1
FAIL .dub/build/application-debug-linux.posix-x86-dmd_2067-FDAB6DCF10EB7D29BC4DAB2CF2FAFD5C/ dsfmlapps executable
Error executing command build:
dmd failed with exit code 1.

I made sure I installed both sfml and csmfl on my Ubuntu (14.04 32bit) through the repository. Any idea what is the problem?

Edit: here is my dub.json file

{
    "name": "dsfmlapps",
    "description": "A minimal D application.",
    "copyright": "Copyright © 2015, karabuta",
    "authors": ["karabuta"],
    "lflags" : ["-L/usr/include"],
    "dependencies": {
        "dsfml": "~master"    
    }
}
1

There are 1 answers

0
Kai Nacke On

I think this is a bug in the dub.json from DSMFL. It contains specification of libraries in the form: "libs": [ "dsfml-audio" ]. But "libs" specifies an external library found somewhere else! The name here is dsfml-audio but if you look in the build directory from DSFML then you will see that the library file is named libdsfml_audio. (Note - versus _ in the name.)

Solution is to remove all "libs": [ "..." ], lines from the dub.json file. Use dub -v to check the referenced files!