Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

Instalacja Allegro v5 problem...

Ostatnio zmodyfikowano 2013-12-04 18:07
Autor Wiadomość
Zdziwiony
Temat założony przez niniejszego użytkownika
Instalacja Allegro v5 problem...
» 2013-12-04 16:34:01
Witam. Mam taki problem: Otóż po zainstalowaniu allegro, i jego przetestowaniu coś działa nie tak ;/
Kod przykładowego programu (z tego serwisu)
C/C++
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>


int main()
{
    allegro_init();
    install_keyboard();
    set_color_depth( 8 );
    set_gfx_mode( GFX_AUTODETECT, 800, 600, 0, 0 );
    set_palette( default_palette );
    clear_to_color( screen, 48 );
    textout_ex( screen, font, "Witaj w Allegro !", 20, 20, makecol( 255, 0, 255 ), - 1 );
   
    readkey();
   
    allegro_exit();
    return 0;
}
END_OF_MAIN();

Log komplinacji:
mingw32-g++.exe    -c C:\Users\Łukasz\Desktop\test\main.cpp -o C:\Users\Łukasz\Desktop\test\main.o
C:\Users\Łukasz\Desktop\test\main.cpp: In function 'int main()':
C:\Users\Łukasz\Desktop\test\main.cpp:8:18: error: 'allegro_init' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:9:22: error: 'install_keyboard' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:10:24: error: 'set_color_depth' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:11:19: error: 'GFX_AUTODETECT' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:11:50: error: 'set_gfx_mode' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:12:18: error: 'default_palette' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:12:34: error: 'set_palette' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:13:21: error: 'screen' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:13:32: error: 'clear_to_color' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:14:25: error: 'font' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:14:81: error: 'makecol' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:14:88: error: 'textout_ex' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:16:13: error: 'readkey' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp:18:18: error: 'allegro_exit' was not declared in this scope
C:\Users\Łukasz\Desktop\test\main.cpp: At global scope:
C:\Users\Łukasz\Desktop\test\main.cpp:21:14: error: expected constructor, destructor, or type conversion before ';' token
Process terminated with status 1 (0 minutes, 0 seconds)
15 errors, 0 warnings (0 minutes, 0 seconds)

Allegro zainstalowałem kopiując jego pliki to Code::Blocks\\MiniGW... co zrobiłem nie tak ?
P-98275
pekfos
» 2013-12-04 16:37:03
Kod przykładowego programu (z tego serwisu)
Nie przypominam sobie, żeby był na tej stronie kurs allegro 5 ;) Za to jest allegro 4.x, który jest w pełni niekompatybilny z 5.
P-98276
Zdziwiony
Temat założony przez niniejszego użytkownika
» 2013-12-04 16:38:54
Oto link:
http://cpp0x.pl/kursy/Kurs-Allegro-4-x-C++/Odpalamy-Allegro/64
Drugi kod od góry.

EDIT:

Aha... Chyba, że tak :P A czym się rózni Allegro 5 od 4.x ? Są jakieś duże różnice ? (jakieś nowości etc.) ?
P-98277
SeaMonster131
» 2013-12-04 16:41:33
Tak, Allegro5 całkowicie różni się od 4.
P-98279
Zdziwiony
Temat założony przez niniejszego użytkownika
» 2013-12-04 16:43:47
Czyli... bardziej opłaca się uczyć 4 czy 5 :) ?
Która wersja jest prostsza i daje większe możliwości ?


EDIT:
Znalazłem taki kod na v5
C/C++
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
int main()
{
    al_init();
    al_install_keyboard();
    al_init_image_addon();
    ALLEGRO_KEYBOARD_STATE klawiatura;
    ALLEGRO_DISPLAY * okno = al_create_display( 320, 240 );
    al_set_window_title( okno, "Allegro5 kurs pierwsze okno" );
    ALLEGRO_BITMAP * obrazek = al_load_bitmap( "widok.png" );
    while( !al_key_down( & klawiatura, ALLEGRO_KEY_ESCAPE ) )
    {
        al_get_keyboard_state( & klawiatura );
        al_clear_to_color( al_map_rgb( 0, 255, 0 ) );
        al_draw_bitmap( obrazek, 0, 0, 0 );
        al_flip_display();
    }
    al_destroy_bitmap( obrazek );
    al_destroy_display( okno );
    return 0;
}

Log komplinacji:
mingw32-g++.exe    -c C:\Users\Łukasz\Desktop\test\main.cpp -o C:\Users\Łukasz\Desktop\test\main.o
mingw32-g++.exe -L"C:\Program Files (x86)\CodeBlocks\allegro-5.0.10-mingw-4.7.0\lib"  -o C:\Users\Łukasz\Desktop\test\main.exe C:\Users\Łukasz\Desktop\test\main.o  
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x59): undefined reference to `al_install_system'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x5e): undefined reference to `al_install_keyboard'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x63): undefined reference to `al_init_image_addon'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x77): undefined reference to `al_create_display'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x95): undefined reference to `al_set_window_title'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0xa1): undefined reference to `al_load_bitmap'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0xbe): undefined reference to `al_get_keyboard_state'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0xe2): undefined reference to `al_map_rgb'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0xfa): undefined reference to `al_clear_to_color'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x123): undefined reference to `al_draw_bitmap'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x128): undefined reference to `al_flip_display'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x144): undefined reference to `al_key_down'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x15e): undefined reference to `al_destroy_bitmap'
C:\Users\Łukasz\Desktop\test\main.o:main.cpp:(.text+0x16d): undefined reference to `al_destroy_display'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
14 errors, 0 warnings (0 minutes, 0 seconds)

Coś chyba jest nie tak z instalacją :/ ?
Mój MiniGW to 4.7.1 a pobrałem dla 4.7.0... Czy to moze sprawiać problem ?
P-98282
SeaMonster131
» 2013-12-04 16:46:08
Oczywiście, że ucz się nowszej. A czy jest prostsza? Zależy od osoby.
P-98286
pekfos
» 2013-12-04 16:52:16
Coś chyba jest nie tak z instalacją :/ ?
Podlinkuj allegro.
P-98289
Zdziwiony
Temat założony przez niniejszego użytkownika
» 2013-12-04 16:56:47
W linker settings ?
Ale co tam wpisać :P ?
P-98291
« 1 » 2
  Strona 1 z 2 Następna strona