Reputation: 30102
How would I import an Objective-C header in Objective-C++?
This is the header:
typedef struct _xmlDoc xmlDoc;
typedef struct _xmlNs xmlNs;
typedef struct _xmlAttr xmlAttr;
typedef struct _xmlNode {
void* _field1;
int _field2;
char* _field3;
struct xmlNode* _field4;
struct xmlNode* _field5;
struct xmlNode* _field6;
struct xmlNode* _field7;
struct xmlNode* _field8;
xmlDoc* _field9;
xmlNs* _field10;
char* _field11;
xmlAttr* _field12;
xmlNs* _field13;
void* _field14;
unsigned short _field15;
unsigned short _field16;
} xmlNode;
typedef struct _xmlDict xmlDict;
typedef struct _xmlDtd xmlDtd;
struct _xmlDoc {
void* _field1;
int _field2;
char* _field3;
struct xmlNode* _field4;
struct xmlNode* _field5;
struct xmlNode* _field6;
struct xmlNode* _field7;
struct xmlNode* _field8;
struct xmlDoc* _field9;
int _field10;
int _field11;
struct xmlDtd* _field12;
struct xmlDtd* _field13;
struct xmlNs* _field14;
char* _field15;
char* _field16;
void* _field17;
void* _field18;
char* _field19;
int _field20;
struct xmlDict* _field21;
void* _field22;
int _field23;
int _field24;
};
struct _xmlNs {
struct xmlNs* _field1;
int _field2;
char* _field3;
char* _field4;
void* _field5;
struct xmlDoc* _field6;
};
struct _xmlAttr {
void* _field1;
int _field2;
char* _field3;
struct xmlNode* _field4;
struct xmlNode* _field5;
struct xmlNode* _field6;
struct xmlAttr* _field7;
struct xmlAttr* _field8;
struct xmlDoc* _field9;
struct xmlNs* _field10;
int _field11;
void* _field12;
};
struct _xmlDtd;
struct _xmlDict;
typedef struct sqlite3 sqlite3;
typedef struct sqlite3_stmt sqlite3_stmt;
When compiling my project it throws the following errors:
Structs.h:49:3: error: typedef redefinition with different types ('struct _xmlNode' vs 'xmlNode')
} xmlNode;
^
Structs.h:36:9: note: previous definition is here
struct xmlNode* _field4;
^
Structs.h:62:9: error: elaborated type refers to a typedef
struct xmlDoc* _field9;
^
Structs.h:29:24: note: declared here
typedef struct _xmlDoc xmlDoc;
^
Structs.h:65:9: error: elaborated type refers to a typedef
struct xmlDtd* _field12;
^
Structs.h:52:24: note: declared here
typedef struct _xmlDtd xmlDtd;
^
Structs.h:67:9: error: elaborated type refers to a typedef
struct xmlNs* _field14;
^
Structs.h:30:23: note: declared here
typedef struct _xmlNs xmlNs;
^
Structs.h:74:9: error: elaborated type refers to a typedef
struct xmlDict* _field21;
^
Structs.h:51:25: note: declared here
typedef struct _xmlDict xmlDict;
^
Structs.h:81:9: error: elaborated type refers to a typedef
struct xmlNs* _field1;
^
Structs.h:30:23: note: declared here
typedef struct _xmlNs xmlNs;
^
Structs.h:86:9: error: elaborated type refers to a typedef
struct xmlDoc* _field6;
^
Structs.h:29:24: note: declared here
typedef struct _xmlDoc xmlDoc;
^
Structs.h:96:9: error: elaborated type refers to a typedef
struct xmlAttr* _field7;
^
Structs.h:31:25: note: declared here
typedef struct _xmlAttr xmlAttr;
^
Structs.h:98:9: error: elaborated type refers to a typedef
struct xmlDoc* _field9;
^
Structs.h:29:24: note: declared here
typedef struct _xmlDoc xmlDoc;
^
Structs.h:99:9: error: elaborated type refers to a typedef
struct xmlNs* _field10;
^
Structs.h:30:23: note: declared here
typedef struct _xmlNs xmlNs;
Isn't this because the header is written in Objective-C?
Upvotes: 0
Views: 557
Reputation: 42588
Yeah, the problem is you don't have anything defined of type struct xmlNode
. You have a type struct _xmlNode
and a type xmlNode
, but not struct xmlNode
. You can replace all instances of struct xmlNode
with xmlNode
or struct _xmlNode
.
Upvotes: 3