Update: All is well. Recompiled allegro5 from source (using wiki guide). Then linked Allegro files to compiler in C::B and all is well. Was able to display a basic window.
Now begins the learning.
=========================
Okay.
Trying to set Allegro 5.0.1 up on my lap top.
OS: Ubuntu 14.04LTS
IDE: C::B 13.12
Compilers (apologize for formatting):
sean@sean-Satellite-A205:~$ dpkg --list | grep compiler
ii g++ 4:4.8.2-1ubuntu6 i386 GNU C++ compiler
ii g++-4.8 4.8.2-19ubuntu1 i386 GNU C++ compiler
ii gcc 4:4.8.2-1ubuntu6 i386 GNU C compiler
ii gcc-4.8 4.8.2-19ubuntu1 i386 GNU C compiler
ii hardening-includes 2.5ubuntu2.1 all Makefile for enabling compiler flags for security hardening
ii libllvm3.5:i386 1:3.5-4ubuntu2~trusty2 i386 Modular compiler and toolchain technologies, runtime library
ii libxkbcommon0:i386 0.4.1-0ubuntu1 i386 library interface to the XKB compiler
Problem:
I compiled Allegro 5.0.1 properly using CMake (I hope). I then tried to compile the following code and received error messages:
===================================================
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
int main(void)
{
al_show_native_message_box(NULL, "3.8","321World!", "Hello world!",
"Whatever|Maybe", "ALLEGRO_MESSAGEBOX_YES_NO");
return -1;
if(!al_init())
{
al_show_native_message_box(NULL, NULL, NULL, “Error!”, NULL, NULL);
return -1;
}
}
==================================================
||=== Build: Debug in alkdsjf (compiler: GNU GCC Compiler) ===|
/home/sean/Desktop/Test/alkdsjf/main.c||In function ‘main’:|
/home/sean/Desktop/Test/alkdsjf/main.c|11|warning: passing argument 6 of ‘al_show_native_message_box’ makes integer from pointer without a cast [enabled by default]|
/usr/local/include/allegro5/allegro_native_dialog.h|51|note: expected ‘int’ but argument is of type ‘char *’|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: stray ‘\342’ in program|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: stray ‘\200’ in program|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: stray ‘\234’ in program|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: ‘Error’ undeclared (first use in this function)|
/home/sean/Desktop/Test/alkdsjf/main.c|23|note: each undeclared identifier is reported only once for each function it appears in|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: expected ‘)’ before ‘!’ token|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: stray ‘\342’ in program|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: stray ‘\200’ in program|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: stray ‘\235’ in program|
/home/sean/Desktop/Test/alkdsjf/main.c|23|error: too few arguments to function ‘al_show_native_message_box’|
/usr/local/include/allegro5/allegro_native_dialog.h|51|note: declared here|
||=== Build failed: 9 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|
=======================================================
What am I messing up here? Most errors center around al_show_etc... lines.
If more information is needed just let me know. I will admit that I am new to both Ubuntu and Allegro.
Thanks in advance.
Sean
First of all, 5.0.1 is really old. You should use a binary for 5.0.10 or 5.1.9 if available, or compile one of those versions.
int al_show_native_message_box( ALLEGRO_DISPLAY *display, char const *title, char const *heading, char const *text, char const *buttons, int flags );
The first call to al_show_native_message_box is wrong because the last parameter should be an integer (ALLEGRO_MESSAGEBOX_YES_NO), not a string ("ALLEGRO_MESSAGEBOX_YES_NO").
al_show_native_message_box( NULL, "3.8", "321World!", "Hello world!", "Whatever|Maybe", "ALLEGRO_MESSAGEBOX_YES_NO" ); al_show_native_message_box(NULL, NULL, NULL, Error!, NULL, NULL);
Again, the last parameter should be an int flag ALLEGRO_MESSAGEBOX_YES_NO, not a pointer (NULL)
I suggest using the PPAs with Ubuntu: http://liballeg.org/download.html#ubuntu-ppa, if you want to avoid the (minor) pain of compiling it yourself.
To get the PPA, do I need to create a login? Could not find a way to acquire the PPA. Maybe I am misunderstanding the usage of PPA's though. From what I gather I need to download the PPA then use a few command line entries to make everything work, is this correct? I will probably update Allegro5 once I completely install this version. Just want to successfully install it so that I can see the process and what is involved. Building from source was not super challenging with the resources provided on the allegro.wiki.
Changed code to the following:
====================================
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
int main(void)
{
al_show_native_message_box(NULL, "3.8","321World!", "Hello world!", "Whatever|Maybe", 2);
return -1;
}
====================================
I omitted the last al_show_native_message_box() statement( maybe in error, looked like error handling statement). Just trying to simplify code for testing purposes. When I tried to compile the above I received the following:
||=== Build: Debug in alkdsjf (compiler: GNU GCC Compiler) ===|
obj/Debug/main.o||In function `main':|
/home/sean/Desktop/Test/alkdsjf/main.c|9|undefined reference to `al_show_native_message_box'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
AGAIN, thanks for dealing with my newbish ways.
You need to link to the native dialog addon.
I've added a small tutorial on how to use PPAs here: https://wiki.allegro.cc/index.php?title=Install_Allegro_from_Ubuntu_PPAs
Thanks be to the both of you.
I upgraded my laptop from Ubuntu 32-bit to Ubuntu 64-bit. Therefore, I will be repeating this process this weekend. This will give me the ability to step up to the newest stable Allegro5.
I would really like to complete the build from source route + proper linking so that I can learn how to properly add new resources to my computer.
I will review the PPA (makes me think of Philadelphia Parking Authority, of which I do not have a great relationship with)tutorial as well because I am deficient in this area as well.
Thank you both.
Will update as I proceed this weekend.
Sean
EDIT: Wow. Just reviewed you PPA tutorial and that looks remarkably easy.