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
gcc main.o -lallegro -o a
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 :/
]]>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?
]]>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.
]]>Library Version: 5.2.2.1
Header Version: 5.2.4 (GIT)
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
cd build_allegro_monolith
cmake \
-G"MSYS Makefiles" \
-DCMAKE_SYSTEM_PREFIX_PATH=/mingw64/x86_64-w64-mingw32/ \
-DWANT_MONOLITH=on \
-DSHARED=off \
../allegro5
make
make install
but I am guessing this is wrong, eh?
]]>You want to 'git checkout 5.2' or master if you're going to build allegro yourself. Don't mix binaries and custom installs.
]]>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.
]]>