[英]error: member access into incomplete type 'WINDOW' (aka '_win_st')
我在訪問 _maxx 時遇到問題,它說:./ScoreBoard.hpp:20:38: 錯誤:成員訪問不完整類型“WINDOW”(又名“_win_st”) mvwprintw(score_win, 0, score_win->_maxx - 10, "% 11llu", 分數); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/curses.h:322:16:注意:'_win_st' typedef struct _win_st WINDOW 的前向聲明;
這是我的代碼:
#pragma once
class Scoreboard {
protected:
WINDOW * score_win;
public :
Scoreboard(){
}
Scoreboard(int width, int y, int x){
score_win = newwin(1, width, y, x);
}
void initialize(int initial_score){
this->clear();
mvwprintw(score_win, 0, 0, "Score: ");
updateScore(initial_score);
this->refresh();
}
void updateScore(int score){
mvwprintw(score_win, 0, score_win->_maxx - 10, "%11llu", score);
}
void clear(){
wclear(score_win);
}
void refresh(){
wrefresh(score_win);
}
};
如評論中所述, WINDOW
可能是不透明的。 這是 ncurses 的可配置功能,用於 MacOS SDK。在curses.h
的頂部,您可能會看到
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 5
#define NCURSES_VERSION_MINOR 7
#define NCURSES_VERSION_PATCH 20081102
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
#define NCURSES_VERSION "5.7"
2007 年3 月添加了不透明功能:
+ add NCURSES_OPAQUE symbol to curses.h, will use to make structs
opaque in selected configurations.
不是使用WINDOW
結構的成員,而是有一些函數可以讓你讀取數據:
X/Open Curses 沒有指定WINDOW
(或其他類型)是否不透明,但沒有提及_maxx
等結構成員。 便攜式應用程序應該更喜歡標准化的功能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.