View Full Version : error on compilation of an allegro program

01-16-2005, 01:37 PM
I compiled the following program using gcc in Red Hat Linux 9.0,

#include "allegro.h"

int main(void)
if (allegro_init() != 0)
return 1;

if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) {
if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
return 1;
clear_to_color(screen, makecol(255, 255, 255));

textout_centre_ex(screen, font, "Hello, world!", SCREEN_W/2, SCREEN_H/2, makecol(0,0,0), -1);



return 0;


This is a simple demo program I got with the allegro library, but on compilation I got the following error:

[root@localhost demo]# gcc -o demo demo.c
In file included from /usr/include/allegro/base.h:40,
from /usr/include/allegro.h:25,
from demo.c:25:
/usr/include/allegro/internal/alconfig.h:304:5: #error endianess not defined

Can anyone please help me out


01-16-2005, 05:46 PM
Put your source code in code tags - it makes it much easier for us to read by preserving spacing and putting it in a more appropriate font. Put [/code] at the end of your code, and [code] at the beginning. Doing this will solicit a lot more help.

01-16-2005, 06:35 PM
>> gcc -o demo demo.c

you need to link the allegro libs using -l and -L

01-17-2005, 02:50 AM
> [root@localhost demo]# gcc -o demo demo.c
And doing real work as root is just asking for a world-of-pain at some point.
Your random code with "remove-file-system-bug" will do exactly that with all the privileges it has.

Create a separate user account for all your work, and only use root when you absolutely MUST use root.

I bet you surf the net in a browser running as root as well - jeez, just open the door and invite everyone in.

01-18-2005, 08:10 AM
And how do I link these libraries using -l or -L?

By the way, I don't use the internet by logging in root, I use Windows for that (unfortunately).

01-18-2005, 02:27 PM
It appears you are getting a compiler error, not a linker error. In that case, Perspective's advice wouldn't fix your current problem (although it may still be necessary).

I did a quick google search on your problem, and the only other time this error occurs is during a bad allegro installation. You might want to try reinstalling all the allegro library files.