Pregunta

I've compiled my SFML program with g++ and that seems to be working fine now (had issues with it previously), however when I try to run the resulting output, I get the following error message:

dyld: lazy symbol binding failed: Symbol not found: __ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE
  Referenced from: /Users/fabricecastel/Work/Game_Projects/SFML_tutorials/./a.out
  Expected in: /usr/local/lib/libsfml-graphics.2.dylib

dyld: Symbol not found: __ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE
  Referenced from: /Users/fabricecastel/Work/Game_Projects/SFML_tutorials/./a.out
  Expected in: /usr/local/lib/libsfml-graphics.2.dylib

Trace/BPT trap: 5

I've checked the folder in question and libsfml-graphics.2.dylib isn't missing. Besides that I'm at a total loss as to what the issue is and how I'm supposed to fix it. Seems to me that the RenderWindow symbol isn't included in the dylib but it should be. We're talking SFML 2.1 here, not some obscure amateur project. What's up with that?

¿Fue útil?

Solución

The only way I could reproduce these errors is when GCC and Clang version of SFML are mixed. Here are two procedures that create the same errors.

  • First procedure
    1. install the GCC version
    2. compile your application (successfully)
    3. install the Clang version
    4. run your application
  • Second procedure
    1. install the Clang version
    2. compile your application (successfully)
    3. install the GCC version
    4. run your application

When you install another runtime, you need to carefully rebuild from scratch your application. That is, remove the final binary as well as any .o files before compiling.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top