-2

i'm trying to load bitmap like this:

BITMAP *image = load_bitmap("picture.bmp", NULL);

when I test it:

if (image == NULL)
   printf("No image loaded\n");

it prints No image loaded so load_bitmap doesn't work ... i have also tried absolute path but still nothing.

Im using Ubuntu and allegro 4.2

Some suggestions?

miskohut
  • 957
  • 1
  • 14
  • 34

1 Answers1

2

Did you try placing the image on the same location as the executable? After that is solved check this things also if still getting the error:

  • Is really a *.bmp file? A file of a different type can not be converted by just renaming it.

  • Is the file you are trying to read actually called like that? Check for spelling both in code and in the file explorer.

  • Does the program run correctly if executed from the file explorer or command-line but not from the IDE? If that is the case, then you should change the configuration of the workspace or project you are currently using so that the execution directory is the same as the one where the image file is located.

If all else fails then try following the steps of the tutorial again, perhaps you made something wrong. By the way, if this is your first C++ project I recommend you that instead go to more basic stuff and stick to the command-line for a while until you get the hang of the facilities the language and its libraries have to offer.

rlam12
  • 603
  • 5
  • 16