Witam!
[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status
C:\Documents and Settings\domek\Moje dokumenty\Allegro\Makefile.win [Build Error] [Projekt2.exe] Error 1
Błąd pojawia się gdy próbuję uruchomić np. to:
#include <allegro5/allegro5.h>
#include <allegro5/a5_font.h>
#include <allegro5/a5_ttf.h>
#include <iostream>
#undef main
void main()
{
al_init();
al_init_font_addon();
al_install_keyboard();
if ( !al_create_display(640,480) )
{
std::cout << "Nie udalo sie utworzyc okna!" << std::endl;
getchar();
return;
}
al_set_window_title("Kurs Allegro - Pierwszy program, czcionki.");
ALLEGRO_FONT* font;
font = al_load_ttf_font( "times.ttf", 48, 0 );
if ( !font )
{
std::cout << "Nie udalo sie wczytac czcionki!" << std::endl;
getchar();
return;
}
ALLEGRO_KEYBOARD_STATE key_state;
al_get_keyboard_state(&key_state);
while(!al_key_down(&key_state, ALLEGRO_KEY_ESCAPE))
{
al_get_keyboard_state(&key_state);
al_clear_to_color( al_map_rgb(0,0,0) );
al_draw_text( font, 320, 216, ALLEGRO_ALIGN_CENTRE, "Witaj swiecie!" );
al_flip_display();
}
}
lub też to:
#include <allegro.h>
int main()
{
allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0);
clear_to_color(screen, makecol(128,128,128));
// RYSOWANIE
// Piksel
putpixel(screen, 10, 20, makecol(255,0,255));
putpixel(screen, 10, 30, makecol(255,255,0));
// Kąt
arc(screen, SCREEN_W/2, SCREEN_H/2,itofix(0), itofix(128), 100, makecol(0, 0, 0));
// Linie
hline(screen, 20, 400, 500, makecol(255,255,255));
vline(screen, 20, 400, 500, makecol(255,255,255));
line( screen,400,200,600,400, makecol(255,128,64));
// Trójkąt
triangle(screen, 20,20,60,60,20,60,makecol(255,0,128));
// Prostokąt
rectfill(screen, 500, 400, 700, 500, makecol(128,30,30));
rect(screen, 490, 390, 710, 510, makecol(30,30,30));
// Okrąg
circle(screen, 100, 100,50, makecol(255,64,64));
circlefill(screen, 100, 100,40, makecol(255,64,64));
// Elipsa
ellipse(screen, 300, 50, 60, 40, makecol(128,20,128));
ellipsefill(screen, 300, 50, 50, 30, makecol(128,20,20));
// Wypełnianie
ellipse(screen, 700,200,80,30,makecol(50,50,50));
floodfill(screen,700,200,makecol(20,120,20));
readkey();
allegro_exit();
return 0;
}
END_OF_MAIN();
Chciałbym ruszyć nieco do przodu, bo na obecną chwilę prawidłowo kompiluje mi się jedynie jaskiniowy prymityw:
#include <allegro.h>
int main()
{
allegro_init();
allegro_exit();
return 0;
}
END_OF_MAIN();
... i to dosyć irytujące ; ) Cóż mam zrobić?
Pozdrawiam