标题:linux程序语法错误
取消只看楼主
jingzitakk66
Rank: 1
等 级:新手上路
帖 子:198
专家分:0
注 册:2009-5-1
结帖率:98.68%
已结贴  问题点数:20 回复次数:2 
linux程序语法错误
这个程序调试出现了一系列问题,不知道怎么更正语法错误啊
//head.h
1 #ifndef HEAD_H
      2 #define HEAD_H
      3 char *fgets_(char *,int,FILE *);
      4 #endif


//main.c
  1 #include "stdio.h"
      2 #include "head.h"
      3
      4 main()
      5
      6 {
      7     char *a[10];
      8     printf("%s",fets_(a,10,stdin));
      9 }
//fgets_.c
      1 #include"string.h"
      2 #include"head.h"
      3
      4 char *fgets_(char *dest,int num,FILE *fp)
      5 {
      6     int i;
      7     int ch;
      8
      9     for(i=0;i<num-1;i++)
     10         {
     11         ch=getc(fp);
     12         *(dest+num-1)='\n';
     13         if(ch!='/n')
     14         *(dest+i)=getc(fp);
     15         else return dest;
     16
     17         }
     18
     19         return dest;
     20
     21 }
     
gcc main.c fgets_.c head.h后出现下面错
[apple@localhost program]$ gcc main.c fgets_.c head.h
In file included from fgets_.c:2:
head.h:3: error: syntax error before "FILE"
fgets_.c:4: error: syntax error before "FILE"
fgets_.c: In function `fgets_':
fgets_.c:9: error: `num' undeclared (first use in this function)
fgets_.c:9: error: (Each undeclared identifier is reported only once
fgets_.c:9: error: for each function it appears in.)
fgets_.c:11: error: `fp' undeclared (first use in this function)
fgets_.c:12: error: `dest' undeclared (first use in this function)
fgets_.c:13:10: warning: multi-character character constant
head.h:3: error: syntax error before "FILE"
[apple@localhost program]$
搜索更多相关主题的帖子: linux 
2009-08-02 23:09
jingzitakk66
Rank: 1
等 级:新手上路
帖 子:198
专家分:0
注 册:2009-5-1
得分:0 
回复 3楼 wxjeacen
你简直不知所云,不解决问题请不要回帖.
2009-08-03 20:57
jingzitakk66
Rank: 1
等 级:新手上路
帖 子:198
专家分:0
注 册:2009-5-1
得分:0 
回复 楼主 jingzitakk66
非常感谢,第一次搞这个程序.
2009-08-03 21:17



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-281379-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.163174 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved