SFML 2.1 & “lazy symbol binding failed”

人走茶凉 提交于 2019-12-13 04:30:26

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/17911878/sfml-2-1-lazy-symbol-binding-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!