|
Can't initialize allegro |
yasyaserov
Member #16,760
October 2017
|
Hello, I've been trying to compile and run using msys2. I followed instructions in the wiki (with additional stuff in forums for cmake part) and I finally installed allegro(I think). But the problem is after compiling. I've used: gcc -Wall main.c `pkg-config --cflags --libs allegro-5 allegro_main-5` and gcc -c main.c but after I run the program, it gives allegro failed to initialize error(basically al_init() returns false) I really don't know what to do :/ |
SiegeLord
Member #7,827
October 2006
|
Can you add this code to your main function (before al_init) and see what it prints? uint32_t version = al_get_allegro_version(); int major = version >> 24; int minor = (version >> 16) & 255; int revision = (version >> 8) & 255; int release = version & 255; printf("Library version: %d.%d.%d.%d\n", major, minor, revision, release); printf("Header version: %s\n", ALLEGRO_VERSION_STR); It it prints different things, then something went wrong when you installed Allegro (via make install). Can you tell us what commands you used for cmake and make? "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
beoran
Member #12,636
March 2011
|
l guess that you have another, older version of allegro somewhere on your system that gets linked in at run time. On linux, you could try ldd program to see what kibraries will be linked at runtime. |
yasyaserov
Member #16,760
October 2017
|
Library Version: 5.2.2.1 Yeah these are different. I probably need to uninstall MSYS2 and reinstall everything. What am I supposed to after installing mingw toolchain and dependencies. I did: git clone https://github.com/liballeg/allegro5.git git checkout 5.0 mkdir build_allegro_monolith make but I am guessing this is wrong, eh? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You want to 'git checkout 5.2' or master if you're going to build allegro yourself. Don't mix binaries and custom installs. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
SiegeLord
Member #7,827
October 2006
|
Somehow you have a separate installation of Allegro. Find where it is, and remove it. You can use the http://www.dependencywalker.com/ to see which DLLs your binary is loading (very useful if you plan to distribute your binary to other computers, so you include everything). Also... yes, you want to do git checkout master, or, perhaps, git checkout 5.2.3.0 if you want the most recent release. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
|