[英]Strange Build Errors in XCode
I have this method declaration in an interface: 我在接口中有以下方法声明:
#import "LotPolygon.h"
...
@interface LotLattice : NSObject {
... //member variables
}
- (LotPolygon *) lotPolygonContainingCoordinate:(CLLocationCoordinate2D)coord;
...
@end
The compiler gives this error for the method declaration: 编译器为方法声明给出此错误:
Expected ')' before LotPolygon.
在LotPolygon之前应为')'。
If I comment it out, the code builds with the warning you'd expect (Lotlattice may not respond...) and functions and that method works just as it's supposed to. 如果我将其注释掉,则代码会生成预期的警告(Lotlattice可能不会响应...)和函数,并且该方法将按预期工作。 But that warning really bothers me because it makes it less likely that I'll see other warnings that I need to see.
但是,该警告确实使我感到困扰,因为它使我不太可能看到需要查看的其他警告。 I'd really like it to compile with the proper declaration, and I just can't see anything wrong with that line.
我真的很希望它能与正确的声明一起编译,而且我看不出该行有什么问题。
I've even tried moving that line around in the file to see if it was really a line right before it that was pissing off Xcode, but no--It really doesn't like that line. 我什至尝试在文件中四处移动该行,以查看它是否真的是在惹恼Xcode的行,但是不,它确实不喜欢该行。 Any ideas?
有任何想法吗?
XCode usually print that error when it couldn't find LotPolygon declaration. XCode在找不到LotPolygon声明时通常会打印该错误。 Make sure it can find the @interface and the @implementation of that object
确保它可以找到该对象的@interface和@implementation
That error means that the compiler doesn't know about the LotPolygon
class. 该错误意味着编译器不了解
LotPolygon
类。 Either include the header file that defines that class, or add a forward declaration : 要么包含定义该类的头文件,要么添加一个前向声明 :
// This says that LotPolygon is the name of a class, but it doesn't define
// anything else about it
@class LotPolygon;
- (LotPolygon *) lotPolygonContainingCoordinate:(CLLocationCoordinate2D)coord;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.