0

I have this strange problem with a game I'm making in c++ with Allegro.

There is a part of the game that uses some images from the source folder.

I compile it through gcc and create the executable file main, it works fine when I call ./main from the terminal... The games load every images and works just fine.

But if I open finder, navigate and double click on the same main it crashes because it doesn't success on loading the images from the source. The same thing happens if I try to open it from Instruments too.

The source code folder structure is:

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

and the image loading function is the base function of Allegro

al_load_bitmap("item.png");
elkiwy
  • 59
  • 5

1 Answers1

0

This is the expected behaviour on macOS. You need a bundle for this to work. It's in the official macOS faq:

http://liballeg.org/stabledocs/en/build/macosx.html

Ues a tool called fixbundle.

deets
  • 6,285
  • 29
  • 28
  • Uhm... apparently installing allegro through homebrew didn't installed everything and I miss the fixbundle command... I'll try to rebuild allegro source up and hope for the best. – elkiwy Oct 05 '17 at 11:05
  • I built allegro source even with the "make install" at the end but still no fixbundle command... Any suggestion? – elkiwy Oct 05 '17 at 11:21
  • 1
    Ok, I managed to implement a "bundle making thing" into my makefile so now when I make it automagically makes the .app file with all the necessary stuff inside to make it work properly. – elkiwy Oct 05 '17 at 12:17