Having problems setting up Allegro.
PamperBoy

Hi as the title says, im having trouble setting up allegro.

I used code from a tutorial to check if allegro worked on my pc. As you can see he has made an error box if it didnt work. So it says "Error Could not initialize allegro 5".

I copy-pasted all the files in the correct folders

Does anyone know how to fix this?

____________________________________________________________________________

#SelectExpand
1#include<allegro5/allegro.h> 2#include<allegro5/allegro_native_dialog.h> 3#include<allegro5/allegro_primitives.h> 4 5#define ScreenWidth 800 6#define ScreenHeight 600 7 8int main() 9{ 10 ALLEGRO_DISPLAY *display; 11 12 if(al_init()) 13 { 14 al_show_native_message_box(NULL, NULL, "Error", "Could not initialize Allegro 5", NULL, ALLEGRO_MESSAGEBOX_ERROR); 15 return -1; 16 } 17 display = al_create_display(ScreenWidth, ScreenHeight); 18 19 if(!display) 20 { 21 al_show_native_message_box(NULL, NULL, "Error", "Could not create Allegro 5 display", NULL, ALLEGRO_MESSAGEBOX_ERROR); 22 return -1; 23 } 24 25 // Drawing *not important for you guys* 26 al_set_new_display_flags(ALLEGRO_NOFRAME); 27 al_set_window_position(display, 200, 100); 28 al_set_window_title(display, "CodingMadeEasy"); 29 30 ALLEGRO_COLOR electricBlue = al_map_rgb(44, 117, 255); 31 32 float points[8] = { 0, 0, 400, 100, 50, 200, ScreenWidth, ScreenHeight }; 33 34 al_draw_triangle(10, 10, 20, 10, 25, 50, al_map_rgb(255, 0, 0), 1.0); 35 //al_draw_filled_triangle(10, 10, 20, 10, 25, 50, al_map_rgb(255, 0, 0), 1.0); 36 37 al_draw_rounded_rectangle(10, 10, 100, 100, 5, 5, al_map_rgb(0, 255, 0), 3); 38 //al_draw_filled_rounded_rectangle(10, 10, 100, 100, 5, 5, al_map_rgb(0, 255, 0), 3); 39 40 al_draw_rectangle(400, 400, 450, 500, al_map_rgb(255, 98, 100), 9.0); 41 //al_draw_filled_rectangle(400, 400, 450, 500, al_map_rgb(255, 98, 100), 9.0); 42 43 al_draw_circle(ScreenWidth / 2, ScreenHeight / 2, 10, al_map_rgb(255, 255, 0), 3.0); 44 //al_draw_filled_circle(ScreenWidth / 2, ScreenHeight / 2, 10, al_map_rgb(255, 255, 0), 3.0); 45 46 al_draw_ellipse(ScreenWidth / 2, ScreenHeight - 100, 10, 5, al_map_rgb(255, 0, 255), 4.0); 47 //al_draw_filled_ellipse(ScreenWidth / 2, ScreenHeight - 100, 10, 5, al_map_rgb(255, 0, 255), 4.0); 48 49 al_draw_arc(10, ScreenHeight - 100, 10, 0, 4.0, al_map_rgb(255, 0, 0), 2.0); 50 51 al_draw_line(100, 500, 300, 500, electricBlue, 6.0); 52 53 al_draw_pixel(500, 500, electricBlue); 54 55 al_draw_spline(points, electricBlue, 1.0); 56 57 al_flip_display(); 58 al_rest(5.0); 59 al_destroy_display(display); 60 61 return 0; 62}

Edgar Reynaldo
PamperBoy said:

if(al_init()) {
al_show_native_message_box(NULL, NULL, "Error", "Could not initialize Allegro 5", NULL, ALLEGRO_MESSAGEBOX_ERROR); return -1; }

al_init is a wrapper for al_install_system, and al_install_system returns true if it was successful. So it is working, but your check condition is backwards.

PamperBoy

How do you mean backwards? Somehow it's working on his screen. (also im a beginner) can you tell me what to do? sry :P

taronĀ 
if (!al_init())
{
    //something went wrong
}

if (al_init())
{
   //OK
}

PamperBoy

aah thx! But now i get this!:-/

'Game.exe': Loaded 'D:\Game Assignment\Game\Debug\Game.exe', Symbols loaded.
'Game.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\allegro-5.0.10-monolith-md-debug.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.18120_none_72d2e82386681b36\GdiPlus.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\comdlg32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18201_none_ec80f00e8593ece5\comctl32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'Game.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\d3d8thk.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\nvd3dum.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x23c4) has exited with code 0 (0x0).
'Game.exe': Loaded 'C:\Windows\SysWOW64\nvspcap.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\nvapi.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'Game.exe': Loaded 'C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPI.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x630) has exited with code 3 (0x3).
The thread 'Win32 Thread' (0x1184) has exited with code 3 (0x3).
The program '[8604] Game.exe: Native' has exited with code 3 (0x3).

Edgar Reynaldo
PamperBoy said:

Cannot find or open the PDB file

You can safely ignore this. It just means it couldn't find any debugging symbols for that library.

Quote:

Exit code 3

Not sure what this is from. The code you posted above never returns 3 for a value. Do you have other code you're compiling that you didn't show us?

PamperBoy said:

 display = al_create_display(ScreenWidth, ScreenHeight);
 if(!display) { al_show_native_message_box(NULL, NULL, "Error", "Could not create Allegro 5 display", NULL, ALLEGRO_MESSAGEBOX_ERROR);
 return -1; 
} // Drawing *not important for you guys* 

al_set_new_display_flags(ALLEGRO_NOFRAME);

You need to call al_set_new_display_flags before you create your display. Or it won't affect anything.

Thread #613831. Printed from Allegro.cc