Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Xcode 3.2.3的静态库编译问题_Xcode_Xcode3.2 - Fatal编程技术网

使用Xcode 3.2.3的静态库编译问题

使用Xcode 3.2.3的静态库编译问题,xcode,xcode3.2,Xcode,Xcode3.2,我正在尝试使用Xcode 3.2.3开发一个新的静态库 Xcode在我的G.h文件中给出了奇怪的错误消息,如下所示。 这些错误的原因是什么 查尔斯 #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> #import <UIKit/UIKitDefines.h> @interface G : NSObject { int fontSize, canvasWidth,

我正在尝试使用Xcode 3.2.3开发一个新的静态库

Xcode在我的G.h文件中给出了奇怪的错误消息,如下所示。 这些错误的原因是什么

查尔斯

#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <UIKit/UIKitDefines.h>

@interface G : NSObject {
  int fontSize, canvasWidth, canvasHeight;
}

UIColor *lightslategray;  
  error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token

@property int fontSize, canvasWidth, canvasHeight;

-(void) DrawLine:(float)x1 :(float)y1 :(float)x2 :(float)y2 :(float) lineWidth: (UIColor *)color;
  error: expected ')' before 'UIColor'

@end

您的代码可能如下所示:

#import <UIKit/UIKit.h>

@interface G : NSObject {
  int fontSize, canvasWidth, canvasHeight;
  UIColor *lightslategray;  
}

@property (nonatomic, assign) int fontSize;
@property (nonatomic, assign) int canvasWidth;
@property (nonatomic, assign) int canvasHeight;

-(void) drawLine: (float)x1 y1:(float)y1 x2:(float)x2 y2:(float)y2 lineWidth:(float) lineWidth color: (UIColor *)color;

@end

这是您有史以来的第一个Objective-C程序,不是吗?

是的,我是Objective-C开发的新手。但是,您的代码会给出相同的错误消息。当我的原始代码是应用程序的一部分时,它可以很好地编译和运行。只有当我尝试将此代码移动到静态库项目时,才会发生此错误。一定是出了什么事。