błędy w podczas kompilacji programu w C (+ curses)
: 08 lis 2008, 18:16
mam problemy podczas kompilacji programów napisanych w C (kompiluje przez gcc) wykorzystujących bilbiotekę <curses.h>.
kompiluje tak:
gcc nazwa.c -o nazwa -lcurses (tak na uczelnie na fedorze robie i działa)
ale u mnie taki sposób kompilacji wywala błędy. mam zainstalowane essetial (czy coś takiego do gcc) oraz wsyzstkie pakiety z synaptica które mi pokazał synaptic po wpisaniu "gcc" w wyszukiwaniu
kod przykładowego programu:
#include <curses.h>
/*zmienne*/
static WINDOW *mainwnd;
static WINDOW *screen;
int pos_x,pos_y,x,y;
int koniec=1,znak_konca;
main(/*int ArgC,char *ArgV[]*/)
{
printf("podaj rozmiary i pozycje okna: \n");
printf("podaj pozycje X: ");scanf("%d",&pos_x);printf("\n");
printf("podaj pozycje Y: ");scanf("%d",&pos_y);printf("\n");
printf("podaj dlugosc okna: ");scanf("%d",&x);printf("\n");
printf("podaj szerokosc okna: ");scanf("%d",&y);printf("\n");
while (koniec)
{
znak_konca=getch();
if (znak_konca==113) koniec=0;
mainwnd=initscr();
noecho();
refresh();
wrefresh(mainwnd);
screen=newwin(y,x,pos_x,pos_y);
box(screen,0,0);
wrefresh(screen);
refresh();
}
endwin();
}
i błędy jakie wyrzuca kompilator:
gcc: lcurses: No such file or directory
prog_2.c:1:20: error: curses.h: No such file or directory
prog_2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
prog_2.c:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
prog_2.c: In function ‘main’:
prog_2.c:13: warning: incompatible implicit declaration of built-in function ‘printf’
prog_2.c:14: warning: incompatible implicit declaration of built-in function ‘scanf’
prog_2.c:23: error: ‘mainwnd’ undeclared (first use in this function)
prog_2.c:23: error: (Each undeclared identifier is reported only once
prog_2.c:23: error: for each function it appears in.)
prog_2.c:27: error: ‘screen’ undeclared (first use in this function)
gcc: -E or -x required when input is from standard input
za każdą pomoc wielkie dzięki
kompiluje tak:
gcc nazwa.c -o nazwa -lcurses (tak na uczelnie na fedorze robie i działa)
ale u mnie taki sposób kompilacji wywala błędy. mam zainstalowane essetial (czy coś takiego do gcc) oraz wsyzstkie pakiety z synaptica które mi pokazał synaptic po wpisaniu "gcc" w wyszukiwaniu
kod przykładowego programu:
#include <curses.h>
/*zmienne*/
static WINDOW *mainwnd;
static WINDOW *screen;
int pos_x,pos_y,x,y;
int koniec=1,znak_konca;
main(/*int ArgC,char *ArgV[]*/)
{
printf("podaj rozmiary i pozycje okna: \n");
printf("podaj pozycje X: ");scanf("%d",&pos_x);printf("\n");
printf("podaj pozycje Y: ");scanf("%d",&pos_y);printf("\n");
printf("podaj dlugosc okna: ");scanf("%d",&x);printf("\n");
printf("podaj szerokosc okna: ");scanf("%d",&y);printf("\n");
while (koniec)
{
znak_konca=getch();
if (znak_konca==113) koniec=0;
mainwnd=initscr();
noecho();
refresh();
wrefresh(mainwnd);
screen=newwin(y,x,pos_x,pos_y);
box(screen,0,0);
wrefresh(screen);
refresh();
}
endwin();
}
i błędy jakie wyrzuca kompilator:
gcc: lcurses: No such file or directory
prog_2.c:1:20: error: curses.h: No such file or directory
prog_2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
prog_2.c:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
prog_2.c: In function ‘main’:
prog_2.c:13: warning: incompatible implicit declaration of built-in function ‘printf’
prog_2.c:14: warning: incompatible implicit declaration of built-in function ‘scanf’
prog_2.c:23: error: ‘mainwnd’ undeclared (first use in this function)
prog_2.c:23: error: (Each undeclared identifier is reported only once
prog_2.c:23: error: for each function it appears in.)
prog_2.c:27: error: ‘screen’ undeclared (first use in this function)
gcc: -E or -x required when input is from standard input
za każdą pomoc wielkie dzięki