设置sfml [英] setting up sfml
问题描述
我遵循版本2和代码块的sfml入门指南,并且完成了本教程告诉我的所有操作:
I'm following the sfml getting started guide for version 2 and codeblocks and did everything the tutorial told me to do :
-
下载并解压缩了sdk
downloaded and unzipped the sdk
添加了sfml标头和库的路径
added the path to the sfml headers and libraries
链接了库的图形,窗口和系统
linked the libraries graphics, window and system
,但是示例代码无效。我收到错误消息,提示缺少sfml-graphics-d-2.dll。编译正常,窗口打开,但保持黑色,并弹出此错误。
这是教程
的链接 http:/ /www.sfml-dev.org/tutorials/2.0/start-cb.php
but the sample code doesnt work. I'm getting the error message that sfml-graphics-d-2.dll is missing. Compilation works, the window opens but remains black and this error pops up. Here's the link to the tutorial http://www.sfml-dev.org/tutorials/2.0/start-cb.php
由于我是c ++和代码块的新手,所以我将不胜感激详细的答案。
Since Im new to c++ and codeblocks, I would be grateful for a detailed answer.
更新:
我已将SFML dll复制到可执行文件中。现在我的程序崩溃了。我不知道为什么与本教程中使用的代码完全相同。
UPDATE: I have copied the SFML dlls to the executable. Now my program just crashes. I don't know why. It's the exact same code as used in the tutorial.
更新:
我已将链接库更改为-s版本,并添加了#define SFML_STATIC。该程序仍会生成,然后崩溃
UPDATE: I have changed the linked libraries to the -s version and added the #define SFML_STATIC. The program still builds and then crashes
推荐答案
如果您使用的是最新的Code :: Blocks版本,其中包括GCC 4.7。 1,那么您必须自己重新编译SFML(或使用我的 Nightly Builds ),因为所提供的仅适用于< 4.7.x。
If you're using the latest Code::Blocks version, which includes GCC 4.7.1, then you have to recompile SFML on your own (or use my Nightly Builds), because the ones provided are only for GCC versions < 4.7.x.
这篇关于设置sfml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!