2017-05-07 14 views
2

私は、UbuntuのC言語のncurses.hライブラリを使って、画面に星のユニコード文字を配置しようとしています。ncursesでワイドなユニコード文字を印刷する

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

しかし、私はこの機能にもかかわらず、エラー

implicit declaration of function ‘mvaddwstr’ [-Wimplicit-function-declaration] 

を取得しておくだけでなく、私はに取得することはできません同様の機能と一緒にhereを文書化している:私は実行しようとしているコードは以下の通りでありますいずれかの作業。私はこの作品を作ることを含めないいくつかの図書館はありますか?またはこの文字を表示する別の方法がありますか?私はどんな助けにも感謝します。

+0

[CでのUnicodeシンボルの印刷](http://stackoverflow.com/questions/43834315/printing-a-unicode-symbol-in-c)の可能な複製 –

答えて

1

あなたは、私は次のようにUbuntuの16.04であなたの例をコンパイルすることができました "狭い" 呪い(ncursesw対のncurses)に対して

をコンパイルする必要があります。

apt install libncursesw5-dev 

# --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 

そして

./main 

私は次の違いをあなたのサンプルコードにも加えなければなりませんでした:

- const wchar_t* star = L"0x2605"; 
+ const wchar_t* star = L"\x2605"; 
関連する問題