$ $ sudo apt-get install libncurses-dev
安裝 UTF-8中文環境:
$ sudo apt-get install libncursesw5-dev
再來,還需要安裝一個 函式庫:libunistring
下載處: https://www.gnu.org/software/libunistring/
下載檔案:libunistring-0.9.10.tar.xz
$ xz -d libunistring-0.9.10.tar.xz // 先解開 .xz 檔 --> libunistring-0.9.10.tar
$ tar -xvf libunistring-0.9.10.tar
$ cd libunistring-0.9.10
//========= 安裝libunistring,先看看裡面有什麼檔案。
$ ls -las
$ ./autogen.sh
$ ./configure
$ make
$sudo make install
//===================== 測試 ==========================
測試:
c Program:
//===============================
#include <stdio.h>
#include <wchar.h>
#include <curses.h>
#include <ncurses.h>
#include <stdlib.h>
#include <wctype.h>
#include <locale.h>
int main() {
setlocale(LC_CTYPE, "");
initscr();
cbreak();
WINDOW *win = newwin(0, 0, 0, 0);
refresh();
wrefresh(win);
const wchar_t* star = L"0x2605";
mvaddwstr(3, 3, star);
getch();
endwin();
}
//=============================== Compile
# --cflags expanded to: -D_GNU_SOURCE -I/usr/include/ncursesw
$ gcc main.c $(ncursesw5-config --cflags) -c
# --libs expanded to: -lncursesw -ltinfo
$ gcc main.o $(ncursesw5-config --libs) -o main