NCurses 설치하기

한국 데비안 사용자 모임
둘러보기로 가기 검색하러 가기
작성일자: 2015년 10월 27일
작성자: westporch

NCurses 다운로드

ftp://ftp.gnu.org/pub/gnu/ncurses/ 에서 최신 버전의 NCurses를 다운받습니다. 2015.12.27 기준으로 최신 버전인 ncurses-6.0을 설치하겠습니다.

root@RaspberryPi:~/Downloads# wget ftp://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
--2015-12-27 14:47:12--  ftp://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
=> ‘ncurses-6.0.tar.gz’
Resolving ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b
Connecting to ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub/gnu/ncurses ... done.
==> SIZE ncurses-6.0.tar.gz ... 3131891
==> PASV ... done.    ==> RETR ncurses-6.0.tar.gz ... done.
Length: 3131891 (3.0M) (unauthoritative)

ncurses-6.0.tar.gz          100%[===========================================>]   2.99M  1.50MB/s   in 2.0s   

2015-12-27 14:47:18 (1.50 MB/s) - ‘ncurses-6.0.tar.gz’ saved [3131891]

root@RaspberryPi:~/Downloads#


NCurses 설치

다운 받은 ncurses 파일의 압축을 해제합니다.

root@RaspberryPi:~/Downloads# ls
ncurses-6.0.tar.gz
root@RaspberryPi:~/Downloads# tar zxvf ncurses-6.0.tar.gz
root@RaspberryPi:~/Downloads# ls
ncurses-6.0  ncurses-6.0.tar.gz
root@RaspberryPi:~/Downloads#

압축을 해제한 ncurses-6.0 폴더로 이동합니다.

root@RaspberryPi:~/Downloads# cd ncurses-6.0
root@RaspberryPi:~/Downloads/ncurses-6.0#

./configure

root@RaspberryPi:~/Downloads/ncurses-6.0# ./configure
(...생략...)
Appending rules for normal model (form: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (form: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for normal model (test: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (test: ticlib+termlib+ext_tinfo+base+ext_funcs)
creating headers.sh

** Configuration summary for NCURSES 6.0 20150808:

       extended funcs: yes
	   xterm terminfo: xterm-new

	   bin directory: /usr/bin
       lib directory: /usr/lib
       include directory: /usr/include
       man directory: /usr/share/man
       terminfo directory: /usr/share/terminfo

root@RaspberryPi:~/Downloads/ncurses-6.0#

make

root@RaspberryPi:~/Downloads/ncurses-6.0# make
make[1]: Leaving directory '/root/Downloads/ncurses-6.0/misc'
root@RaspberryPi:~/Downloads/ncurses-6.0#

make install

root@RaspberryPi:~/Downloads/ncurses-6.0# make install
installing std
installing stdcrt
installing vt100
installing vt300
/usr/bin/install -c ncurses-config /usr/bin/ncurses6-config
make[1]: Leaving directory '/root/Downloads/ncurses-6.0/misc'
root@RaspberryPi:~/Downloads/ncurses-6.0#

설치 확인

NCurses 라이브러리를 이용하여 Hello World를 출력하는 프로그램을 만들어 보겠습니다.

Hello World 프로그램

root@RaspberryPi:~/NCurses# vi hello.c

hello.c 소스

 1 //hello.c   
 2 #include <ncurses.h>
 3 
 4 int main()
 5 {
 6     initscr();              // Start curses mode
 7     printw("Hello World");  // Print Hello World
 8     refresh();              // Print it on to the real screen
 9     getch();                // Wait for user input
10     endwin();               // End curses mode
11 
12     return 0;
13 }

컴파일

root@RaspberryPi:~/NCurses# gcc -o hello hello.c -lncurses
root@RaspberryPi:~/NCurses# 

실행

root@RaspberryPi:~/NCurses# ls
hello  hello.c
root@RaspberryPi:~/NCurses# ./hello

hello 파일을 실행하면 Hello World가 출력됩니다.

Hello World