免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4711 | 回复: 8
打印 上一主题 下一主题

明明是第一次定义,为什么总是报错说我重定义? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-12 14:32 |只看该作者 |倒序浏览
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.c
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(49) : error C2061: syntax error : identifier 'ino_t'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(5 : error C2059: syntax error : '}'
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2371: 'FALSE' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : see declaration of 'FALSE'
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2086: 'FALSE' : redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2371: 'TRUE' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : see declaration of 'TRUE'
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2086: 'TRUE' : redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(34) : error C2371: 'RECID' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(34) : see declaration of 'RECID'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(11) : error C2011: 'PFhdr_str' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(31) : error C2011: 'PFfpage' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(49) : error C2061: syntax error : identifier 'ino_t'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(5 : error C2059: syntax error : '}'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(73) : error C2011: 'PFbpage' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(97) : error C2011: 'PFhash_entry' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2371: 'FALSE' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : see declaration of 'FALSE'
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2086: 'FALSE' : redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2371: 'TRUE' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : see declaration of 'TRUE'
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2086: 'TRUE' : redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(34) : error C2371: 'RECID' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(34) : see declaration of 'RECID'
c:\documents and settings\dou\my documents\damson\复件 uf-4\test.c(21) : warning C4013: 'testuf' undefined; assuming extern returning int
c:\documents and settings\dou\my documents\damson\复件 uf-4\test.c(40) : warning C4013: 'exit' undefined; assuming extern returning int
c:\documents and settings\dou\my documents\damson\复件 uf-4\test.c(87) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char ** '
c:\documents and settings\dou\my documents\damson\复件 uf-4\test.c(87) : warning C4024: 'UF_GetNextRec' : different types for formal and actual parameter 3
c:\documents and settings\dou\my documents\damson\复件 uf-4\test.c(127) : error C2371: 'testuf' : redefinition; different basic types
uf.c
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(33) : error C2065: 'PF_PAGE_SIZE' : undeclared identifier
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(33) : error C2057: expected constant expression
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(49) : error C2061: syntax error : identifier 'ino_t'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(5 : error C2059: syntax error : '}'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(75) : error C2229: struct 'PFbpage' has an illegal zero-sized array
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(11) : error C2011: 'PFhdr_str' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(31) : error C2011: 'PFfpage' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(49) : error C2061: syntax error : identifier 'ino_t'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(5 : error C2059: syntax error : '}'
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(73) : error C2011: 'PFbpage' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\pftypes.h(97) : error C2011: 'PFhash_entry' : 'struct' type redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2371: 'FALSE' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : see declaration of 'FALSE'
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2086: 'FALSE' : redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2371: 'TRUE' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : see declaration of 'TRUE'
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(15) : error C2086: 'TRUE' : redefinition
c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(34) : error C2371: 'RECID' : redefinition; different basic types
        c:\documents and settings\dou\my documents\damson\复件 uf-4\minirel.h(34) : see declaration of 'RECID'
c:\documents and settings\dou\my documents\damson\复件 uf-4\uf.c(91) : warning C4013: 'exit' undefined; assuming extern returning int
c:\documents and settings\dou\my documents\damson\复件 uf-4\uf.c(285) : warning C4013: 'PF_DirtyPage' undefined; assuming extern returning int
c:\documents and settings\dou\my documents\damson\复件 uf-4\uf.c(294) : warning C4013: 'PF_UnfixPage' undefined; assuming extern returning int
Error executing cl.exe.

test.exe - 35 error(s), 7 warning(s)


明明是第一次定义,为什么总是报错说我重定义?疯掉了~
大家帮忙看看呀,呜呜~

论坛徽章:
0
2 [报告]
发表于 2005-12-12 14:33 |只看该作者
这个是minimel.h文件的代码

#ifdef MINIREL_H
#define MINIREL_H
#else

/*
* minirel.h: global defintions
*/


#undef FALSE
#undef TRUE
/*
* boolean type
*/
typedef enum { FALSE = 0, TRUE } bool_t;
#define FALSE        0
#define TRUE        1


/*
* use double for real
*/
typedef double real;


/*
* RECID: unique record identifier
*      pagenum: number of page containing record
*      recnum: number of record on that page
*/
typedef struct{
    unsigned short pagenum;
    unsigned short recnum;
} RECID;


/*
* supported types
*/
#define INT_TYPE        'i'
#define REAL_TYPE        'f'
#define STRING_TYPE        'c'


/*
* number of supported types
*/
#define NTYPES                3


/*
* supported operators
*/
#define EQ_OP                0
#define NE_OP                1
#define LT_OP                2
#define LE_OP                3
#define GT_OP                4
#define GE_OP                5


/*
* macros to extract an int, a real, or a RECID
*/
#define get_int(intp, charp)            memcpy((char *)(intp),                \
                                               (char *)(charp),                \
                                               sizeof(int))
#define get_real(realp, charp)                memcpy((char *)(realp),                \
                                               (char *)(charp),                \
                                               sizeof(real))
#define get_recid(recidp, charp)        memcpy((char *)(recidp),        \
                                               (char *)(charp),                \
                                               sizeof(RECID))


/*
* other useful macros
*/
#define MAX(x, y)                        ((x) > (y) ? (x) : (y))
#define MIN(x, y)                        ((x) < (y) ? (x) : (y))

/*
* computes the offset of a field in a record (should be in <stddef.h>)
*/
#ifndef offsetof
#       define offsetof(type, field)        ((size_t)&(((type *)0) -> field))
#endif

#endif /* MINIREL_H */

/*
* $Header: /var/home/mcauliff/cs564/h/RCS/minirel.h,v 1.1 1991/11/18 03:16:50 mcauliff Exp mcauliff $
*
* $Log: minirel.h,v $
* Revision 1.1  1991/11/18  03:16:50  mcauliff
* Initial revision
*
*/




这个因该是正确的,老师给的源程序,我什么都没修改,添了别的文件进这个project,就出错了。

论坛徽章:
0
3 [报告]
发表于 2005-12-12 14:51 |只看该作者
你说的什么意思啊,上来就发一堆错误

论坛徽章:
0
4 [报告]
发表于 2005-12-12 15:08 |只看该作者
在最底下有问题说明呀,就是问一下遇到这种命名没有重定义,却报重定义错误的问题怎么解决

论坛徽章:
0
5 [报告]
发表于 2005-12-12 15:21 |只看该作者
#undef FALSE
#undef TRUE
/*
* boolean type
*/
typedef enum { FALSE = 0, TRUE } bool_t;
#define FALSE        0
#define TRUE        1
把这句改成这样呢?
#undef FALSE
#define FALSE        0
#undef TRUE
#define TRUE        1
/*
* boolean type
*/
typedef enum { FALSE ,TRUE } bool_t;

论坛徽章:
0
6 [报告]
发表于 2005-12-12 15:22 |只看该作者
#ifdef MINIREL_H
#define MINIREL_H

?????????????

论坛徽章:
0
7 [报告]
发表于 2005-12-12 16:01 |只看该作者
改了这几句倒是这处不报错了。谢谢~
可是出现了更多的其它错误,仍然是不知道怎么改

原帖由 暗底 于 2005-12-12 15:21 发表
#undef FALSE
#undef TRUE
/*
* boolean type
*/
typedef enum { FALSE = 0, TRUE } bool_t;
#define FALSE        0
#define TRUE        1
把这句改成这样呢?
#undef FALSE
#define FALSE        0
...

论坛徽章:
0
8 [报告]
发表于 2005-12-12 16:11 |只看该作者
第一句好象错了#ifdef MINIREL_H
#define MINIREL_H
如果定义了 minirel_h  就用minirel_h  但是#define MINIREL_H 是什么意思呢?这个位置应该是一个语句啊!

[ 本帖最后由 暗底 于 2005-12-12 16:46 编辑 ]

论坛徽章:
0
9 [报告]
发表于 2005-12-12 16:43 |只看该作者
补充说一下,这个是c语言编程
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP