Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Can't load jpg bitmap

This thread is locked; no one can reply to it. rss feed Print
Can't load jpg bitmap
alexx.
Member #10,925
April 2009

( Sorry, please igore. This was fixed after the machine was turned off and on again. Should have tried that earlier. What a frustrating few hours looking for the problem. )

I had this working but then had to reload everything on replacing a smaller disk drive with a bigger one. Allegro seemed to install smoothly.

mkdir build
cd build
cmake ..
make

No errors relating to jpg

But I found programs that previously worked no longer did. Unable to load jpg bitmaps though png was fine.

Here's a bare minimum program that I wrote, can some say what's wrong with it, or wrong with the set up? The output I get from it is:

<b>felix@u18-04-3:~/prog/a5/test/prog$ ./fr_i
set up allegro
al_init() - ok
init_image_addon - ok
jpg fail
felix@u18-04-3:~/prog/a5/test/prog$<b>

Here's the program, will look better with tab=4:

#SelectExpand
1// gedit tab=4 2#include <allegro5/allegro.h> 3#include <addons/image/allegro5/allegro_image.h> 4#include <addons/color/allegro5/allegro_color.h> 5#include <addons/native_dialog/allegro5/allegro_native_dialog.h> 6#include <addons/primitives/allegro5/allegro_primitives.h> 7#include <../../allegro-5.2.5.0/examples/common.c> 8 9int main(int argc, char* argv[]) 10 { 11 open_log(); 12 13 log_printf("set up allegro\nal_init()"); 14 if (!al_init()) 15 { 16 log_printf(" - fail\n"); 17 return 1; 18 } 19 printf(" - ok\ninit_image_addon"); 20 if ( !al_init_image_addon()) 21 { 22 log_printf(" - fail"); 23 return 1; 24 } 25 log_printf(" - ok\n"); 26 27 ALLEGRO_BITMAP* bmp_png = al_load_bitmap("/home/felix/prog/a5/allegro-5.2.5.0/build/examples/data/mysha256x256.png"); 28 if ( bmp_png == NULL ) 29 { 30 log_printf("png fail\n"); 31 close_log(true); 32 return 1; 33 } 34 ALLEGRO_BITMAP* bmp_jpg = al_load_bitmap("/home/felix/prog/a5/allegro-5.2.5.0/build/examples/data/obp.jpg"); 35 if ( bmp_jpg == NULL ) 36 { 37 log_printf("jpg fail\n"); 38 close_log(true); 39 return 1; 40 } 41 42 log_printf("ok\n"); 43 close_log(true); 44 return 0; 45 }

Thanks for any help

GullRaDriel
Member #3,861
September 2003
avatar

TLDR ? A REBOOT FIXED IT ^^

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Go to: