LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1304|回复: 12

static FILE *stream = stdin; 错在哪??

[复制链接]
发表于 2004-1-23 07:17:45 | 显示全部楼层 |阅读模式
make时产生如下错误:
interactive.c:83: error: initializer element is not constant

而interactive.c:83的内容如下:
static FILE *stream = stdin;
请问错在哪??  谢谢!!
发表于 2004-1-23 12:48:11 | 显示全部楼层
试试const static FILE *stream = stdin;
 楼主| 发表于 2004-1-23 16:08:57 | 显示全部楼层
仍然报错!!  下面是与它相关的代码。

# ifndef READLINE
static FILE *stream = stdin;
# endif
发表于 2004-1-23 16:24:09 | 显示全部楼层
stdin不是常量。
发表于 2004-1-23 20:38:54 | 显示全部楼层
以下是FILE的数据类型定义,那个stdin必须要定义为stdin才行
[PHP]
typedef struct  {
        short           level;          /* fill/empty level of buffer */
        unsigned        flags;          /* File status flags    */
        char            fd;             /* File descriptor      */
        unsigned char   hold;           /* Ungetc char if no buffer */
        short           bsize;          /* Buffer size          */
        unsigned char   *buffer;        /* Data transfer buffer */
        unsigned char   *curp;          /* Current active pointer */
        unsigned        istemp;         /* Temporary file indicator */
        short           token;          /* Used for validity checking */
}       FILE;
[/PHP]
 楼主| 发表于 2004-1-23 20:50:34 | 显示全部楼层
我是初学者, 能不能说的具体些,应该怎么改?
发表于 2004-1-23 21:08:15 | 显示全部楼层
在使用之前用
FILE stdin
定义
 楼主| 发表于 2004-1-23 23:36:17 | 显示全部楼层
如何定义?我还是不明白。我是初学者。请多多赐教。谢谢!!
发表于 2004-1-24 00:35:20 | 显示全部楼层
就像定义变量一样定义
你的程序是什么?为什么不贴出来看看?
 楼主| 发表于 2004-1-24 01:12:09 | 显示全部楼层
stdin 已经在/usr/include/stdio.h里面定义过了!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表