|
#include <curses.h>
#define MAZE_X 7
#define MAZE_Y 7
int maze[MAZE_Y][MAZE_X]={ 2,2,2,2,2,2,2 ,
2,0,0,0,2,0,2 ,
2,0,2,0,0,0,2 ,
2,0,0,0,2,0,2 ,
2,0,2,2,2,0,2 ,
2,0,0,0,0,0,2 ,
2,2,2,2,2,2,2 };
void MainLoop(WINDOW * );
void DispMaze(WINDOW * );
int main(void){
WINDOW * MazeWin;
initscr();
cbreak();
noecho();
MazeWin = newwin(MAZE_Y , MAZE_X , 0, 0);
wtimeout(MazeWin,30);
keypad(MazeWin, TRUE);
DispMaze(MazeWin);
MainLoop(MazeWin);
endwin();
}
void DispMaze(WINDOW * MazeWin) {
int x,y;
for( y = 0 ; y < MAZE_Y ; y++)
for( x = 0 ; x < MAZE_Y ; x++)
if( maze[y][x] == 2 ) mvwaddch(MazeWin,y,x,'X');
}
void MainLoop(WINDOW * MazeWin) {
int InputKey;
int Y=1,Y1=1,X=1,X1=1;
while(1){
mvwaddch(MazeWin,Y1,X1,' ');
mvwaddch(MazeWin,Y,X,'@');
wmove(MazeWin,0,0);
wrefresh(MazeWin);
InputKey = wgetch(MazeWin);
if (InputKey =='q') break;
Y1=Y;
X1=X;
if(InputKey == 'h') X--;
else if(InputKey == 'l') X++;
else if(InputKey == 'j') Y++;
else if(InputKey == 'k') Y--;
}
}
UNIXを使っているんですが、上のリストを学校のUNIXでコンパイルするとコンパイルできるのですが自宅のUNIXでコンパイルすると
ld: Undefined symbols:
_cbreak
_endwin
_initscr
_keypad
_newwin
_noecho
_waddch
_wgetch
_wmove
_wrefresh
_wtimeout
ってゆうエラーがでちゃうんですけど、ヘッダファイルの中身って見ることはできないのですか?
|