Skocz do zawartości

Vt 7


en_6280

Rekomendowane odpowiedzi

Witam, po wielu trudach udało mi się skompilować program w konsoli napisany w c++ w bibliotece Allegro za pomocą komendy: gcc main.cpp -o gotowe `allegro-config --libs` '-lstdc++'

teraz gdy uruchamiam mój program za pomocą: ./gotowe

wyskakuję mi w konsoli napis: Allegro application is running on VT 7

Jak uruchomić to VT 7 żebym mógł zobaczyć mój program w akcji??

 

Edit 1:

Kod programu (z jednego z kursów internetowych, działa na windzie):

#include </usr/local/include/allegro.h>
int main()
{ 
  allegro_init();
  install_keyboard();

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

 

Edit 2:

Znalazłem jeden błąd, kompilować powinienem za pomocą polecenia: g++ main.cpp -o gotowe `allegro-config --libs`

Jednakże to nie rozwiązuje mojego problemu z tym VT 7 :(

Odnośnik do komentarza
Udostępnij na innych stronach

Ja instalowałem z repozytorium...

A jak zmienię to co napisałeś to mi wyskakuję:

main.cpp:1:34: error: /usr/include/allegro.h: Nie ma takiego pliku ani katalogu
main.cpp: In function ?int main()?:
main.cpp:4: error: ?allegro_init? was not declared in this scope
main.cpp:5: error: ?install_keyboard? was not declared in this scope
main.cpp:7: error: ?GFX_AUTODETECT_WINDOWED? was not declared in this scope
main.cpp:7: error: ?set_gfx_mode? was not declared in this scope
main.cpp:8: error: ?screen? was not declared in this scope
main.cpp:8: error: ?makecol? was not declared in this scope
main.cpp:8: error: ?clear_to_color? was not declared in this scope
main.cpp:11: error: ?putpixel? was not declared in this scope
main.cpp:14: error: ?SCREEN_W? was not declared in this scope
main.cpp:14: error: ?SCREEN_H? was not declared in this scope
main.cpp:14: error: ?itofix? was not declared in this scope
main.cpp:14: error: ?arc? was not declared in this scope
main.cpp:16: error: ?hline? was not declared in this scope
main.cpp:17: error: ?vline? was not declared in this scope
main.cpp:18: error: ?line? was not declared in this scope
main.cpp:20: error: ?triangle? was not declared in this scope
main.cpp:22: error: ?rectfill? was not declared in this scope
main.cpp:23: error: ?rect? was not declared in this scope
main.cpp:25: error: ?circle? was not declared in this scope
main.cpp:26: error: ?circlefill? was not declared in this scope
main.cpp:28: error: ?ellipse? was not declared in this scope
main.cpp:29: error: ?ellipsefill? was not declared in this scope
main.cpp:32: error: ?floodfill? was not declared in this scope
main.cpp:34: error: ?readkey? was not declared in this scope
main.cpp:35: error: ?allegro_exit? was not declared in this scope
main.cpp: At global scope:
main.cpp:38: error: expected constructor, destructor, or type conversion before ?;? token

bo ja tam nie mam pliku allegro.h

 

Edit 1. Nie wiem czy to ma znaczenie, ale w prawym górnym rogu ikonki skompilowanego programu jest taka mała kłódka.

Odnośnik do komentarza
Udostępnij na innych stronach

Ja instalowałem z repozytorium...

A jak zmienię to co napisałeś to mi wyskakuję:

main.cpp:1:34: error: /usr/include/allegro.h: Nie ma takiego pliku ani katalogu
[...]

A co pokazuje

rpm -qa allegro-devel

Do kompilacji potrzebny Ci jest pakiet allegro-devel (nagłówki) a nie biblioteka allegro.

Odnośnik do komentarza
Udostępnij na innych stronach

No to zainstalowałem to devel i teraz kompilacja działa jak mam #include </usr/include/allegro.h>

z tym że gdy uruchamiam aplikację ciągle widnieje napis: Allegro application is running on VT 7

 

Edit 1. Jak uruchamiam program z konsoli nie jako root to wyskakuje:

Shutting down Allegro due to signal #11

Naruszenie ochrony pamięci (core dumped)

 

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
×
×
  • Dodaj nową pozycję...