I am to the archive and it loads that. I know for a fact that the image is in the correct place too. It just seems to crash when calling that function and I've written the function that way many times before without error.

When I started using A5 recently I found I had difficulty loading stuff as well. Then I learned that A5 has a path-handling system using ALLEGRO_PATH objects. That seemed to solve my problems.

You first create an ALLEGRO_PATH object, then use al_get_standard_path() to get the full path of where your executable is, then you can use al_append_path_component() to go deeper into a directory structure and al_set_path_filename() to set the filename.

Then, to load a file, use al_path_cstr() to convert the contents of an ALLEGRO_PATH object into a string.

Even if this seems overly complicated, it would be good to learn because you can use al_get_standard_path() to get other path locations suitable for storing global data, accessible by all users, or current-user-specific data.

This is the first class that is initialized and that initializes Allegro so there is no chance of that happening :/ If I comment out the contents of Graphics::Load() so it only returns -1 then it still gives the error. I don't think it is to do with allegro :/

Graphics is initialized after Game but before Menu so it's defiantly all initialized first.

I'm in a rush now and don't have you code in front of me anymore, but I think you can get the idea. Menu doesn't have direct access to your game object which explains why the pointer value is 0x0 when inside your menu routine.

See the part in frame #0 where it says 'this = 0x0'. You're trying to dereference a null pointer somehow. I don't know how the address of the auto_ptr got to be null though.

I see what you did.

src\game.h line 33 :

extern std::auto_ptr<Game> game;

src\game.cpp line 3 :

std::auto_ptr<Game> game;

src\main.c line 5 :

std::auto_ptr<Game> game(new Game );

If you had turned on all of your compiler warnings, you would have noticed this :src\main.c:5:29: warning: declaration of 'game' shadows a global declaration(With gcc/MinGW use -Wall and -Wshadow)

So the reason the Menu constructor is crashing is because it uses the global 'game' variable, which has been initialized by the default auto_ptr constructor, which is unable to guess where your object is located, which is why it was trying to dereference a null pointer.

I've never used code blocks but given it's just a front end to mingw you enable the debugging symbols and hopefully c::b includes the debuger.

A quick google says go to the compiler options and tick the box 'produce debugging symbols', then everything else is done via the debug menu like start/stop/jump over/jump in (probably keypresses if you look closely enough in the menu).

That'll get you started in your code (allegro will still be out of bounds as far as drilling down, but most of the time you don't need to anyway). Couldn't be simpler