[英]Redefinition of typedef error
I'm trying to integrate an existing library into my project. 我正在尝试将现有库集成到我的项目中。 But I keep getting this "Redefinition typedef error" when I try to compile.
但是当我尝试编译时,我一直收到此“ Redefinition typedef error”。 Here's the code that's part of the library.
这是库中一部分的代码。
Code: 码:
typedef struct _tagAbc Abc;
typedef void *Apple (Abc* Orange);
typedef struct _tagAbc
{
Apple red;
}
Abc;
It seems that the compiler doesn't like the pre-declared struct and the actual definition of the struct together. 似乎编译器不喜欢预声明的结构和该结构的实际定义。 Is there anywhere to fix this problem?
有什么地方可以解决此问题?
The code is trying to typedef struct _tagAbc twice, once in the first line and once in the actual structure declaration. 该代码尝试两次对def _tagAbc进行typedef两次,一次在第一行,一次在实际结构声明中。 If you modify the structure declaration as shown below it should work correctly.
如果您按如下所示修改结构声明,则它应该可以正常工作。
typedef struct _tagAbc Abc;
typedef void *Apple (Abc* Orange);
struct _tagAbc
{
Apple red;
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.