【发布时间】:2017-10-05 09:41:48
【问题描述】:
我用 Allegro 用 c++ 制作的游戏遇到了这个奇怪的问题。
游戏的一部分使用了源文件夹中的一些图像。
我通过gcc 编译它并创建可执行文件main,当我从终端调用./main 时它工作正常...游戏加载每个图像并且工作正常。
但是,如果我打开 finder,导航并双击相同的 main,它会崩溃,因为它无法从源加载图像。
如果我也尝试从 Instruments 打开它,也会发生同样的事情。
源码文件夹结构为:
project:
| main //the executable is in the root of the project folder
| /src //Where all the cpp and h files are stored
| /obj //Where the .o files are stored
| item.png //images are also in the root of the project folder
图片加载函数是Allegro的基础函数
al_load_bitmap("item.png");
【问题讨论】: