读书人

vc6.0报的异常 各位帮小弟我看看

发布时间: 2012-02-19 19:43:39 作者: rapoo

vc6.0报的错误 各位帮我看看
我带代码:
#include <stdlib.h>
#include <stdio.h>

/////////////////////////////////////////////////////////////////////////////////////////
//消息ID定义
const int nSGIP_BIND= 0x1;
const int nSGIP_BIND_RESP= 0x80000001;
const int nSGIP_UNBIND= 0x2;
const int nSGIP_UNBIND_RESP= 0x80000002;
const int nSGIP_SUBMIT= 0x3;
const int nSGIP_SUBMIT_RESP= 0x80000003;
const int nSGIP_DELIVER= 0x4;
const int nSGIP_DELIVER_RESP= 0x80000004;
const int nSGIP_REPORT= 0x5;
const int nSGIP_REPORT_RESP= 0x80000005;
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
报的错:
:\hzf\mywork\vc\sgip\sgipmsg.h(23) : error C2370: 'nSGIP_BIND ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(23) : see declaration of 'nSGIP_BIND '
d:\hzf\mywork\vc\sgip\sgipmsg.h(24) : error C2370: 'nSGIP_BIND_RESP ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(24) : see declaration of 'nSGIP_BIND_RESP '
d:\hzf\mywork\vc\sgip\sgipmsg.h(25) : error C2370: 'nSGIP_UNBIND ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(25) : see declaration of 'nSGIP_UNBIND '
d:\hzf\mywork\vc\sgip\sgipmsg.h(26) : error C2370: 'nSGIP_UNBIND_RESP ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(26) : see declaration of 'nSGIP_UNBIND_RESP '
d:\hzf\mywork\vc\sgip\sgipmsg.h(27) : error C2370: 'nSGIP_SUBMIT ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(27) : see declaration of 'nSGIP_SUBMIT '
d:\hzf\mywork\vc\sgip\sgipmsg.h(28) : error C2370: 'nSGIP_SUBMIT_RESP ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(28) : see declaration of 'nSGIP_SUBMIT_RESP '
d:\hzf\mywork\vc\sgip\sgipmsg.h(29) : error C2370: 'nSGIP_DELIVER ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(29) : see declaration of 'nSGIP_DELIVER '
d:\hzf\mywork\vc\sgip\sgipmsg.h(30) : error C2370: 'nSGIP_DELIVER_RESP ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(30) : see declaration of 'nSGIP_DELIVER_RESP '
d:\hzf\mywork\vc\sgip\sgipmsg.h(31) : error C2370: 'nSGIP_REPORT ' : redefinition; different storage class


d:\hzf\mywork\vc\sgip\sgipmsg.h(31) : see declaration of 'nSGIP_REPORT '
d:\hzf\mywork\vc\sgip\sgipmsg.h(32) : error C2370: 'nSGIP_REPORT_RESP ' : redefinition; different storage class
d:\hzf\mywork\vc\sgip\sgipmsg.h(32) : see declaration of 'nSGIP_REPORT_RESP '

我找了半天 找不到错吴 各位帮我看看

[解决办法]
是不是和系统的宏定义冲突了?
[解决办法]
#ifndef __MYHFILE__

#define __MYHFILE__

#include <stdlib.h>
#include <stdio.h>

/////////////////////////////////////////////////////////////////////////////////////////
//消息ID定义
const int nSGIP_BIND= 0x1;
const int nSGIP_BIND_RESP= 0x80000001;
const int nSGIP_UNBIND= 0x2;
const int nSGIP_UNBIND_RESP= 0x80000002;
const int nSGIP_SUBMIT= 0x3;
const int nSGIP_SUBMIT_RESP= 0x80000003;
const int nSGIP_DELIVER= 0x4;
const int nSGIP_DELIVER_RESP= 0x80000004;
const int nSGIP_REPORT= 0x5;
const int nSGIP_REPORT_RESP= 0x80000005;
....
#endif
[解决办法]
估计是重复定义问题,或者是头文件宏问题

可以尝试声明成static 暂时避免问题,不过还是最好找出原因

读书人网 >C语言

热点推荐