Curses library问题

一本书的例子中提到用curses library做终端编程,我也查到了,curses.h头文件,但是编译的时候还是出undefined reference to ***的错误,是不是QNX里面没有相应库文件,怎么才能得到库文件呢?

-l curses ?

试过了,还是不行,出现undefined reference的错误.程序代码如下,也请您试试看. 我又查了一下,在系统中好像没有找到 libcurses.so 的库文件,怎么办?

#include <stdio.h>
#include <curses.h>

main()
{
initscr();
clear();
move(10,20);
addstr(“Hello, world”);
move(LINES-1, 0);
refresh();
getch();
endwin();
}

qcc hello1.c -l curses -o hello1

搞清楚原因了,两个错误,把
cc -lcurses hello1.c -o hello1 改成
cc hello1.c -o hello1 -lncurses就成了,我犯了两个错误。
在openqnx上查到相关帖子说
the order of files on the command line does matter. At the point you link in the library, there are no outstanding symbols to resolve, so nothing is linked. Then you link your object which has outstanding symbols, which are not resolved.

If you change the order, your object will have outstanding symbols, which will be resolved by the library which is linked next.
为什么换了顺序就有了outstanding symbol?

Symbol 的搜索是从发现Symbol的文件开始往后搜索的,所以程序库要放在.o文件的后面。
如果一个程序库A需要程序库B的支持,那就要 -l A -l B才行。