当前位置: 技术问答>linux和unix
帮我看看为什么会重复定义?
来源: 互联网 发布时间:2016-03-25
本文导语: gcc编译出现的错误: AddToUnitControl-Request.h:26: error: redefinition of `struct domains' AddToUnitControl-Request.h:32: error: redefinition of `struct programInvocations ' In file included from AdditionalService-Request.h:25, f...
gcc编译出现的错误:
AddToUnitControl-Request.h:26: error: redefinition of `struct domains'
AddToUnitControl-Request.h:32: error: redefinition of `struct programInvocations
'
In file included from AdditionalService-Request.h:25,
from ConfirmedServiceRequest.h:91,
from Confirmed-RequestPDU.h:15,
from MMSpdu.h:14,
from MMSpdu.c:9:
RemoveFromUnitControl-Request.h:26: error: redefinition of `struct domains'
RemoveFromUnitControl-Request.h:32: error: redefinition of `struct programInvoca
tions'
In file included from AdditionalService-Request.h:32,
from ConfirmedServiceRequest.h:91,
from Confirmed-RequestPDU.h:15,
from MMSpdu.h:14,
from MMSpdu.c:9:
重复定义出现的AddToUnitControl-Request.h文件:
typedef struct AddToUnitControl_Request {
Identifier_t unitControl;
struct domains {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} domains;
struct programInvocations {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} programInvocations;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} AddToUnitControl_Request_t;
重复定义出现的RemoveFromUnitControl-Request.h文件:
typedef struct RemoveFromUnitControl_Request {
Identifier_t unitControl;
struct domains {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} domains;
struct programInvocations {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} programInvocations;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} RemoveFromUnitControl_Request_t;
domains结构都是定义在不同的结构里边的,为什么会出现重复定义的错误呢?
AddToUnitControl-Request.h:26: error: redefinition of `struct domains'
AddToUnitControl-Request.h:32: error: redefinition of `struct programInvocations
'
In file included from AdditionalService-Request.h:25,
from ConfirmedServiceRequest.h:91,
from Confirmed-RequestPDU.h:15,
from MMSpdu.h:14,
from MMSpdu.c:9:
RemoveFromUnitControl-Request.h:26: error: redefinition of `struct domains'
RemoveFromUnitControl-Request.h:32: error: redefinition of `struct programInvoca
tions'
In file included from AdditionalService-Request.h:32,
from ConfirmedServiceRequest.h:91,
from Confirmed-RequestPDU.h:15,
from MMSpdu.h:14,
from MMSpdu.c:9:
重复定义出现的AddToUnitControl-Request.h文件:
typedef struct AddToUnitControl_Request {
Identifier_t unitControl;
struct domains {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} domains;
struct programInvocations {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} programInvocations;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} AddToUnitControl_Request_t;
重复定义出现的RemoveFromUnitControl-Request.h文件:
typedef struct RemoveFromUnitControl_Request {
Identifier_t unitControl;
struct domains {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} domains;
struct programInvocations {
A_SEQUENCE_OF(Identifier_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} programInvocations;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} RemoveFromUnitControl_Request_t;
domains结构都是定义在不同的结构里边的,为什么会出现重复定义的错误呢?
|
你虽然在不同的结构中定义的,但是对于编译器来说,这跟定义在外面是一样的。
你可以这样想,你在结构体中定义的宏,在结构体外不是也可以照样使用吗?
你可以这样想,你在结构体中定义的宏,在结构体外不是也可以照样使用吗?
|
gcc不支持这样的用法。提出来吧,或者改名。