It is easy to mixup the BSD libcurses and the SVR4 libcurses. One lives in /usr/ucblib, the other in /usr/ccs/lib, when you've installed SUNWarc. Note that when you specify:
-L/usr/ucblib -lucb -L/usr/ccs/lib -lcurses
you will pick the ucb version of libcurses, not the SVR4 version. If you always put libucb last, as recommended in 6.18, you will have no such problem.