开发者

Expected specifier qualifier list

I have two classes.One is view1 and other is view2.when i declare like thi开发者_JAVA技巧s it is displaying error that "Expected Specifier qualifier list before view1".

code is :

@interface view1 : UIViewController 
{
 view2 *v2;
}
@interface view2 : UIViewController 
{
 view1 *v1;
}

Kindly help me thanks in advance.


You should use the @class directive to tell the compiler that the classes exist before you use them. If the two header files were to #include each other, then the compiler gets confused and you get an error like that.

view1.h:

@class view2;

@interface view1 : UIViewController
{
    view2 *v2;
}

view2.h

@class view1;

@interface view2 : UIViewController
{
    view1 *v1;
}

Then make sure that each of the .m files #import both header files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜