日期:2014-05-16  浏览次数:20714 次

hp-unix上curses编译问题
#include <stdio.h>

//#define _XOPEN_SOURCE_EXTENDED
//#include </usr/include/curses.h>
#include <curses.h>
//#include </usr/local/pa64/lib/gcc-lib/hppa64-hp-hpux11.11/3.3.3/include/curses.h>
//#include </usr/old/usr/include/curses.h>


main() 

int ch,x,y;

WINDOW *win;
  //启动 curses 模式 
   
initscr();
cbreak();
noecho();
nonl();


win=newwin(4,30,LINES/2-3, COLS/2-15); //建立一个新视窗,其中LINES,COLS
box(win,'|','-'); // 为 curses 内定值, 即萤幕行/列数
mvwaddstr(win,1,4,"This is another screen");
mvwaddstr(win,2,2,"Press anykey to continue..");
/*
for (y=0;y<LINES;++y) // 以'@'填满萤幕
for (x=0;x<COLS;++x) 
vprintw(y,x,"@"); 
*/

for ( ; ;) 

refresh(); 
ch=getch(); 
switch(ch) { 
case 'q': // 按 'q' 键离开
endwin(); 
return 0;
//exit(0); 
case '\t': // 按 [TAB] 键 呼叫另一视窗 
touchwin(win); // wrefresh() 前需 touchwin() 
wrefresh(win); 
getch(); // 按任意键关闭视窗 
touchwin(stdscr); 
break; 
default:break; 
}
}
}
编译的时候返回如下错误信息:
test.cpp: In function `int main()':
test.cpp:44: error: `wborder' undeclared (first use this function)
test.cpp:44: error: (Each undeclared identifier is reported only once for each 
  function it appears in.)
test.cpp:45: error: `mvwaddstr' undeclared (first use this function)
如果在#include <curses.h>前面加上
#define _XOPEN_SOURCE_EXTENDED
出现如下编译错误
In file included from test.cpp:5:
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:755: error: type
  specifier omitted for parameter `va_list'
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:756: error: type
  specifier omitted for parameter `va_list'
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:757: error: type
  specifier omitted for parameter `va_list'
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:758: error: type
  specifier omitted for parameter `va_list'
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:1394: error: parse
  error before `,' token
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:1394: error: declaration
  of C function `int waddnstr(...)' conflicts with
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:763: error: previous
  declaration `int waddnstr(WINDOW*, const char*, int)' here
/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include/curses.h:1394: error: parse
  error before `-' token
我该怎么解决,请各位大虾帮忙!

------解决方案--------------------
可能是不支持吧. va_list都没有.