On Thursday, 3 May 2018 at 18:36:04 UTC, RegeleIONESCU wrote:


And here is the error I get when I execute dub run:

christian@Christians:~/D_Projects$ dub run
Performing "debug" build using /usr/bin/dmd for x86_64.
derelict-util 2.0.6: target for configuration "library" is up to date. derelict-sdl2 2.1.4: target for configuration "library" is up to date.
project_01 ~master: building configuration "application"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./project_01
derelict.util.exception.SymbolLoadException@../../.dub/packages/derelict-util-2.0.6/derelict-util/source/derelict/util/exception.d(35):
 Failed to load symbol SDL_DequeueAudio from shared library libSDL2-2.0.so.0


So your app is compiling and executing. This is a runtime error. The SymbolLoadException means the SDL library was loaded, but a function Derelict expected to find was not there. This usually means that your version of Derelict by default supports a different version of SDL than you have on your system.

SDL_DequeueAudio was added to SDL in 2.0.5. The best strategy is just to request the minimum version of SDL that you need via a SharedLibVersion:

import derelict.util.loader : SharedLibVersion;
DerelictSDL2.load(SharedLibVersion(2, 0, 0));

If you need functions from a later version, use that instead (e.g. 2,0,2). Just make sure you have the version of SDL that you need installed.

Also, if you're going to load all of the libraries as in the example, you'll need to make sure they're all installed (SDL_image, SDL_mixer, SDL_net, SDL_ttf). I suggest you delete all except what you actually need. That's not your current problem, but you'll get more exceptions if those libraries aren't installed.

If you want to update to derelict-sdl2 3.0.x or 3.1.x, delete your dub.selections.json before running dub after you edit your package configuration.

Reply via email to