问题描述
我已经用g ++编译了SFML程序,现在看来工作正常(以前有问题),但是当我尝试运行结果输出时,出现以下错误消息:
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
我已经检查了相关的文件夹,并且没有libsfml-graphics.2.dylib.除此之外,我对这个问题是什么以及应该如何解决这个问题完全不知所措.在我看来,dylib中未包含RenderWindow符号,但应该包含它.我们在这里谈论的是SFML 2.1,而不是一些晦涩的业余项目.这是怎么回事?
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?
推荐答案
我唯一重现这些错误的方法是 GCC和SFML的Clang版本混在一起.这是两个创建相同错误的过程.
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.
- 第一步
- 安装GCC版本
- 成功编译您的应用程序
- 安装Clang版本
- 运行您的应用程序
- 安装Clang版本
- 成功编译您的应用程序
- 安装GCC版本
- 运行您的应用程序
在安装另一个运行时时,需要从头开始仔细地重新构建应用程序.也就是说,在编译之前,请删除最终的二进制文件以及所有.o
文件.
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.
这篇关于SFML 2.1和“懒惰的符号绑定失败";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!