0
好的,所以我正在嘗試使用NCurses庫C++更改終端背景。無法使用NCurses更改終端背景
這裏是我的代碼:
int ncurses_test()
{
initscr();
start_color();
init_pair(1, COLOR_GREEN, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3,COLOR_BLUE, COLOR_RED);
wbkgd(WINDOW,COLOR_PAIR(3))
noecho();
raw();
int c;
attron(COLOR_PAIR(1));
printw("Write something [ESC to escape]: ");
while((c=getch())!=27)
{
move(10,0);
attron(COLOR_PAIR(1));
printw("Keycode: %d, and the chracter: %c",c,c);
move(0,0);
attron(COLOR_PAIR(1));
printw("Write something [ESC to escape]: ");
refresh();
}
endwin();
return 0;
}
編譯文件時,我得到一個錯誤。這裏是錯誤:
main.cpp: In function 'int ncurses_test()':
main.cpp:27:18: error: expected primary-expression before ',' token
wbkgd(WINDOW,COLOR_PAIR(3))
有沒有人有任何想法?
更好的後續本來要注意缺少分號。 –
我是多麼愚蠢我感謝您發現。 – NSPredator