[这个贴子最后由samhoo在 2002/09/24 09:24pm 编辑]
说明:CDK(Curses Development Kit http://www.vexus.ca/products/CDK/)是一套基于curses的免费窗体开发库。编译cdk-4.9.10典型错误:
1)在编译库的时候报告S_ISSOCK定义冲突,但还是可以把libcdk.a编译出来。可是,在examples编译的时候就报告S_ISSOCK函数找不到了。
2)报告找不到/usr/bin/install-sh。
3)如果你安装了ncurses库,在编译examples会报告:w32addch, w32...等函数找不到
下面给出解决方法:
*下面的描述假定ncuses库在缺省目录/usr/local/lib, /usr/local/include/ncuses下
1)在include目录下添加一个头文件macro_define.h,内容如下:
#ifndef __MACRO_DEFINE_H__
#define __MACRO_DEFINE_H__
#ifndef S_IFMT
# ifdef _S_IFMT
# define S_IFMT _S_IFMT
# else
# define S_IFMT 0170000
# endif
#endif
#ifndef S_ISDIR
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISCHR
# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
#endif
#ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) (0)
# endif
#endif
#ifndef S_ISREG
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(m) (0)
# endif
#endif
#ifndef S_ISLNK
# ifdef _S_ISLNK
# define S_ISLNK(m) _S_ISLNK(m)
# else
# ifdef _S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
# else
# ifdef S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
# else
# define S_ISLNK(m) (0)
# endif
# endif
# endif
#endif
#ifndef S_ISSOCK
# ifdef _S_ISSOCK
# define S_ISSOCK(m) _S_ISSOCK(m)
# else
# ifdef _S_IFSOCK
# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
# else
# ifdef S_IFSOCK
# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) (0)
# endif
# endif
# endif
#endif
#endif /* __MACRO_DEFINE_H__ */
2)修改include/cdk.h
在54行:#include <math.h>后面添加一行
#include "macro_define.h"
3)如果你没有安装ncurses库,你可以略过本步骤。
修改Makefile.in文件36行为:
CFLAGS = -Iinclude -I/usr/local/include/ncurses @CFLAGS@ @DEFS@
修改examples/Makefile.in文件第7行为:
INCDIR = -I.. -I../include -I/usr/local/include/ncurses
4)然后就可以按常规的进行编译了:
$INSTALL="./install-sh -c";export $INSTALL;configure;make;make install;
cd examples;make
上述方法在SCO OpenServer 5.0.5 + gcc-2.95.2 + ncurses-5.2上无错编译成功,例子运行正常。
如果是cuses库,而不是ncuses库,编译出来的例子运行显示的画面缺少右边和下边的底线
有例子viewer_ex运行的画面,谁要?