2012-05-09 5 views
0

Objective-C++でObjective-Cヘッダーをインポートするにはどうすればよいですか?Objective-C++のObjective-Cヘッダーをインポートしますか?

これはヘッダーです:私のプロジェクトをコンパイルするとき

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; 

それは、次のエラーをスローします:ヘッダはObjective-Cで書かれているので、

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; 

はこのありませんか?

+0

私には壊れているようです - それらのポインタは 'struct _xmlNode *'などでなければなりません。それらは間違った 'typedef'd型を参照しています。 – trojanfoe

答えて

3

ええ、問題はあなたがタイプstruct xmlNodeの何も定義されていないということです。タイプstruct _xmlNodeとタイプxmlNodeですが、struct xmlNodeではありません。 struct xmlNodeのすべてのインスタンスをxmlNodeまたはstruct _xmlNodeに置き換えることができます。

関連する問題