2016-04-16 17 views
0

私たちはターミナルゲームを構築するためにncursesライブラリを使用しようとしています。 initscr()関数は、何らかの理由で余分な情報がないエラーメッセージを返します。 なぜinitscr()がエラーを投げるのか、それをデバッグするために何をすべきかはわかりません。xcodeを使用しているncurses.hライブラリのinitscr()関数のエラー

TerminalView::TerminalView(ViewModel* vm) { 
this->vm = vm; 
this->col_size = vm->get_col_size(); 
this->row_size = vm->get_row_size(); 
this->player_pos = vm->get_player_pos(); 
this-> enemy_pos = vm->get_enemy_pos(); 
this-> projectilePos = vm->getProjectilePos(); 

//initialize ncurses status 
clear(); 
initscr(); 
noecho(); 
cbreak(); 
keypad(stdscr, TRUE); 
curs_set(0); 
} 
+0

エラーは何ですか? –

+0

'clear()'は何をしますか?コードで投稿を編集してください。 –

+0

ncursesマニュアルの[初期化](http://invisible-island.net/ncurses/man/ncurses.3x.html#h3-初期化)のセクションを参照してください。 –

答えて

1

clear()(wclear(stdscr)を呼び出す)は、作成前にstdscrを使用すると考えられます。私の最新のncursesプロジェクトで、私は次のコメント(どこからわからない)を捕獲:

// To initialize the curses, the routine initscr() or 
    // newterm() must be called before any of the other routines 
    // that deal with windows and screens are used. The routine 
    // endwin() must be called before exiting. 

は、私はそれが時々の一つであるとして、あなたがとにかく必要としないと思われ、「()をクリア」をコメントアウトしてください厄介なことncursesはあまりにも多くのことをします。

+0

ええ、私は 'initscr()'を 'clear()'の前に移動するだけですが、同じことが起こります。 –

関連する問題