Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Upgrade from Allegro 5.0.10 to Allegro 5.2.5

This thread is locked; no one can reply to it. rss feed Print
Upgrade from Allegro 5.0.10 to Allegro 5.2.5
Steve Silva
Member #16,936
January 2019
avatar

Hi... I used to programing with Allegro 5.0.10 for about 2 years already and everything was working fine... Now I just noticed that theres a 5.2.5 version and im trying to upgrade by draging the new folders and releasing over the old folders and replacing all the files... but after doing that, when i try to compile my code, i get this error:

D:\CodeBlocks\Projetos\Allegro5\steve.h|134|error: 'WIN32_FIND_DATA' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|134|error: 'HANDLE' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|135|error: 'hFind' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|135|error: 'FindFileData' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|135|error: 'FindFirstFileA' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|139|error: 'INVALID_HANDLE_VALUE' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|141|error: 'FILE_ATTRIBUTE_DIRECTORY' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|146|error: 'FindNextFile' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|147|error: 'FindClose' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|153|error: 'INVALID_HANDLE_VALUE' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|155|error: 'FILE_ATTRIBUTE_DIRECTORY' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|163|error: 'FindNextFile' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|164|error: 'FindClose' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|185|error: 'DWORD' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|186|error: 'attribs' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|186|error: 'INVALID_FILE_ATTRIBUTES' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h||In function 'bool isFile(const char*)':|
D:\CodeBlocks\Projetos\Allegro5\steve.h|190|error: 'DWORD' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|191|error: 'attribs' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|191|error: 'INVALID_FILE_ATTRIBUTES' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1203|error: 'OpenClipboard' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1203|error: 'EmptyClipboard' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1204|error: 'HGLOBAL' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1205|error: 'hg' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1205|error: 'CloseClipboard' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1206|error: 'hg' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1206|error: 'GlobalLock' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1207|error: 'GlobalUnlock' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1207|error: 'CF_TEXT' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1207|error: 'SetClipboardData' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1208|error: 'CloseClipboard' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1208|error: 'GlobalFree' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1212|error: 'OpenClipboard' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1213|error: 'HANDLE' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1214|error: 'hData' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1215|error: 'hData' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1215|error: 'GlobalLock' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1218|error: 'GlobalUnlock' was not declared in this scope|
D:\CodeBlocks\Projetos\Allegro5\steve.h|1218|error: 'CloseClipboard' was not declared in this scope|

Can someone help me how to upgrade from Allegro 5.0.10 to Allegro 5.2.5? Btw im using Code::Blocks IDE (17.12)

Edgar Reynaldo
Member #8,592
May 2007
avatar

on first glance it looks like Allegro 525 doesn't include the windows header anymore that would explain why you're missing all those data. Include allegro_windows.h or windows.h .

Also don't overwrite the files replace them.

Steve Silva
Member #16,936
January 2019
avatar

Edgar Reynaldo THANKS VERYMUCH!!! It worked!!! I just added the windows.h

Edgar Reynaldo
Member #8,592
May 2007
avatar

Steve Silva
Member #16,936
January 2019
avatar

Edgar Reynald can you help me again? Well, at fact, yesterday i was hurried up with doing stuffs out of home... So I just tested about compiling my code and it really worked fine (the part about compilation)... I dont even tried to run the .exe on that moment... Today, when I finally got some time, I tried to run my program and I faced with a new problem after upgraded from allegro 5.0.10 to 5.2.5: for some reason, the al_init() not loads... Can you help me from 0? I restored everything here, now i have the allegro 5.0.10 running perfectly... what exactly i need to do for upgrade to 5.2.5? aparently just draging the include folder from the 5.2.5 over the include folder from the 5.0.10 is not working...

Edgar Reynaldo
Member #8,592
May 2007
avatar

https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5

That should tell you everything you need to get it fixed up. Basically you change your project's search directories and link options.

EDIT
After a PM conversation, here are the answers to your questions, Steve :

1. How to setup your compiler with CodeBlocks :

https://www.allegro.cc/files/attachment/612115

If you install to c:\mingw, then it should auto detect it as well.

Second, you don't link to every version of the allegro library, only the one you need.

Third, you need to compile as C++11 to get to_string and stoi.

Steve Silva
Member #16,936
January 2019
avatar

Well, im almost there... I made the codeblocks recognize the compiler and i removed ALL the linker tags and I just leave these ones:

-lallegro_monolith.dll
-lphysfs

Now it compiles without any error, BUT the al_init() returns 0...

BTW heres the sample code:

#SelectExpand
1#include <cstdio> 2#include <allegro5/allegro.h> 3#include <allegro5/allegro_primitives.h> 4#include "allegro5/allegro_image.h" 5 6int main() { 7 al_init(); 8 al_init_primitives_addon(); 9 al_init_image_addon(); 10 al_install_keyboard(); 11 ALLEGRO_DISPLAY *display=al_create_display(400,225); 12 ALLEGRO_KEYBOARD_STATE keystate; 13 al_set_window_position(display,0,0); 14 al_get_keyboard_state(&keystate); 15 al_set_target_backbuffer(display); 16 al_draw_filled_rectangle(0,0,400,225,al_map_rgb(0,200,0)); 17 al_draw_filled_triangle(20,117.5,200,20,380,117.5,al_map_rgb(255,255,0)); 18 al_draw_filled_triangle(20,117.5,200,205,380,117.5,al_map_rgb(255,255,0)); 19 al_draw_filled_circle(200,117.5,50,al_map_rgb(0,0,255)); 20 al_wait_for_vsync(); 21 al_flip_display(); 22 while(!al_key_down(&keystate,59)) al_get_keyboard_state(&keystate); 23 al_uninstall_system(); 24 return 0; 25}

Edgar Reynaldo
Member #8,592
May 2007
avatar

Now delete the old dlls you were using for 5.0.10 and replace them with the ones that come in the /bin/dlls folder in the distro.

If that still doesn't work, you're compiling against the wrong headers. Make sure you fixed your include path for the compiler.

Steve Silva
Member #16,936
January 2019
avatar

OMG... Finally!!! I did what you told about deleting old dlls
(i deleted them from C:\Windows\System32\ and C:\Windows\SysWOW64\ folders).

But i had to do 2 extra-things:
First, the MinGW\bin and MinGW\include paths that now are
MinGW\i686-w64-mingw32\bin and MinGW\i686-w64-mingw32\include

and i needed also to copy the libdumb.dll to
C:\Windows\System32\ and C:\Windows\SysWOW64\ folders.

Thanks verymuch for all the help!!!

Edit: I got a new problem (the test i did was with the sample code, and everything worked, BUT... the sample code uses only allegro stuffs... My main code uses PhysFS and for now i got this error (not when trying to compile, and even not on the fly, when running it just get error on loading the .exe I needed to debug it to find the error, and the error is this:
C:\LIBS5303Build\physfs-2.0.3\physfs.c: No such file or directory.

Why its searching the Physfs on that folder???? I even not added any folder on codeblocks setup like that, the only thing i used to do is doing a #include with the correct folder where the PhysFS are... how to change this location without needing to CREATE that strange folder just to move my PhysFS to there?)

Edit2: I created that folder on C:\ and moved my PhysFS files to there... now i got a new error (that i need to debug also to find it) there:

https://puu.sh/E2zBa/08953f2d72.png

Edgar Reynaldo
Member #8,592
May 2007
avatar

C:\LIBS5303Build\physfs-2.0.3\physfs.c: No such file or directory.

That is really old. Where did you download that from?

These are the binaries :

https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/downloads/Allegro525_GCC81_MinGW_W64_i686_posix_dwarf.7z

and they go with the compiler I pointed out here :

https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z

You don't need physfs.c, or any .c file. Use the libs like normal. You shouldn't have to compile anything, only link it.

Either your project is messed up, or you downloaded the wrong thing.

Also, don't copy .dll files to your system folders. They don't belong there. Leave them next to your executable file.

Steve Silva
Member #16,936
January 2019
avatar

That is really old. Where did you download that from?

I downloaded both MinGW and A5.2.5 from a link posted from you in anywhere i just dont remember where... But ok, ill download again, these ones you posted right now and ill try again, ill come back later to tell you if it worked or not...

Edgar Reynaldo
Member #8,592
May 2007
avatar

Steve Silva
Member #16,936
January 2019
avatar

Im back, i recorded a very short video (its about 1 min) to show you all the configs, the code im trying to run (its just a sample, but uses both allegro and physfs)

OFC using your new files

https://youtu.be/KbOeIP3vBxE

Edgar Reynaldo
Member #8,592
May 2007
avatar

Okay, things I saw.

1) You don't need to link to libgdi32.a unless you're linking statically.

2) Link to libphysfs.dll (-lphysfs.dll) .

3) You're still compiling against an old version of allegro. Otherwise it wouldn't be looking for the source in LIBS5303Build.

If you installed an old version of allegro it must be removed, especially if it's in c:\mingw\bin and c:\mingw\include.

I tested a PHYSFS example with the same binaries and same compiler you're using and it works fine.

Steve Silva
Member #16,936
January 2019
avatar

I swear i fully deleted both MinGW and Allegro folders BEFORE extracting your ones dude... But ok, the only thing left to test is about:

1) You don't need to link to libgdi32.a unless you're linking statically.
2) Link to libphysfs.dll (-lphysfs.dll) .

Edit: WOW!!! Really these 2 last steps fixed the problem and now even my main code is running fine!!! Thanks very much!!! Specially for your great patience!!! I hope this post can help all people who have the same problem (upgrading from 5.0.10 to 5.2.5) =)

Edgar Reynaldo
Member #8,592
May 2007
avatar

When your exe crashes, could you type 'bt' and post the results?

You must have been linking to an old version of PHYSFS. That is the only thing that could explain it.

Steve Silva
Member #16,936
January 2019
avatar

As i told before, everything is working fine for now just doing the steps 1 and 2... Thanks again =))))))))

Edit: Just to tell you, my PhysFS was downloaded from there
https://icculus.org/pipermail/physfs/2019-March/001280.html

Edgar Reynaldo
Member #8,592
May 2007
avatar

I provided PhysFS along with allegro. That version of physfs is older.

Steve Silva
Member #16,936
January 2019
avatar

Oh nice, I just tested it right now... Its there, thanks...
Well, can you answer me something about PhysFS?
There's anyway how to temporarily disable PhysFS for save things on disc?
For example, when i want to use a al_save_bitmap() to save a screenshot to disk... while using PhysFS it don't work...

Edgar Reynaldo
Member #8,592
May 2007
avatar

Steve Silva
Member #16,936
January 2019
avatar

Thanks verymuch!!! you are a great person =)))

Go to: