Thread: error on compilation of an allegro program

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    2

    Question error on compilation of an allegro program

    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;
    install_keyboard();

    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;
    }
    }
    set_palette(desktop_palette);
    clear_to_color(screen, makecol(255, 255, 255));
    acquire_screen();

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

    release_screen();

    readkey();

    return 0;
    }

    END_OF_MAIN()

    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

    [email protected]

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    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.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >> gcc -o demo demo.c

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

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > [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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    2
    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).

  6. #6
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  4. My Allegro Program will not run...
    By Vicious in forum Game Programming
    Replies: 17
    Last Post: 06-14-2002, 12:49 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM