Thread: Allegro Help

  1. #1
    C++ n00bie :D
    Join Date
    Jul 2004
    Posts
    63

    Allegro Help

    Im starting to get further into coding, and now I need help with Allegro.

    Im following a tutorial to it, but when I try to compile the program, it runs this error:
    Compiler: Default compiler
    Building Makefile: "C:\Documents and Settings\Dan\Desktop\Site\Programming\Allegro\Make file.win"
    Executing make...
    make.exe -f "C:\Documents and Settings\Dan\Desktop\Site\Programming\Allegro\Make file.win" all
    g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include"

    windres.exe -i Allegro_Test_private.rc -I rc -o Allegro_Test_private.res -O coff

    g++.exe main.o Allegro_Test_private.res -o "Allegro Test.exe" -L"C:/Dev-Cpp/lib" -mwindows -lalleg_s -lgdi32 -ldxguid -lole32 -ldinput -lddraw -lwinmm -ldsound

    main.o(.text+0x8b):main.cpp: undefined reference to `_imp__allegro_error'
    main.o(.text+0xc4):main.cpp: undefined reference to `_imp__key'
    main.o(.text+0xdd):main.cpp: undefined reference to `_imp__key'

    make.exe: *** ["Allegro] Error 1

    Execution terminated
    Heres the code, seems right according to the tutorial.
    Code:
    #include <allegro.h>
    
    int initAlleg() {
        set_color_depth(8); //set color to 8 bit
        allegro_init(); //initiate allegro
        install_keyboard(); //initiate keyboard
        if (set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0) < 0) {
            allegro_message("Error setting screen resolution.\n%s\n", allegro_error);
            return -1;
        }
        return 0;
    }
    
    int main() {
        if(initAlleg() < 0) {
            while(! key[KEY_ENTER])
            return 0;
        }    
        while(! key[KEY_ENTER])
        allegro_exit();
        return 0;     
    }
    
    END_OF_MAIN();

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    Add #define ALLEGRO_STATICLINK to the top of your code.
    Last edited by lambs4; 08-14-2004 at 07:33 AM.
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  3. #3
    C++ n00bie :D
    Join Date
    Jul 2004
    Posts
    63
    Thanks, that fixed a few problems

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allegro in C for a newb
    By Ideius in forum C Programming
    Replies: 5
    Last Post: 12-29-2005, 04:36 PM
  2. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  3. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 02:45 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM
  5. Allegro programming in a window
    By Person Man in forum Windows Programming
    Replies: 0
    Last Post: 11-16-2001, 03:23 PM