Objective c 在我的游戏中使用SneekyInput时出现奇怪的错误

Objective c 在我的游戏中使用SneekyInput时出现奇怪的错误,objective-c,cocos2d-iphone,Objective C,Cocos2d Iphone,我正在看这本书,此刻,我正在做一个操纵杆。虽然当我运行游戏时,在编译时会出现以下错误: Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SneakyJoystick", referenced from: objc-class-ref in GameplayLayer.o "_OBJC_CLASS_$_SneakyJoystickSkinnedBase", referenced from: objc-class-ref in

我正在看这本书,此刻,我正在做一个操纵杆。虽然当我运行游戏时,在编译时会出现以下错误:

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_SneakyJoystick", referenced from:
  objc-class-ref in GameplayLayer.o
"_OBJC_CLASS_$_SneakyJoystickSkinnedBase", referenced from:
  objc-class-ref in GameplayLayer.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
这是我的头文件:

// foundation
#import <Foundation/Foundation.h>

// cocos2D and GameCenter
#import "cocos2d.h"
#import <GameKit/GameKit.h>

// Joystick and buttons
#import "SneakyJoystick.h"
#import "SneakyButton.h"

#import "SneakyJoystickSkinnedBase.h"
#import "SneakyButtonSkinnedBase.h"


// sound fx
#import "SimpleAudioEngine.h"

#import "Helpers.h"
#import "GameScene.h"

@interface GameplayLayer : CCLayer {

    // initial player sprite
    CCSprite *player;

    // player health
    int playerStartHealth;

    // joystick
    SneakyJoystick *leftJoystick;

}

@end

这些是链接错误,而不是代码错误。您需要包括定义缺少的符号的文件(作为代码或库):SleekyGoggle和SleekyJoyStickSkinNedBase


(我对这些功能不太熟悉,所以我不确定它们是以代码形式提供的还是以.a文件形式提供的。)

显示项目中的相关代码看起来您是为错误的目标构建的。你在为什么操作系统和设备进行构建?你在项目中添加了偷偷摸摸的输入类了吗?看起来不是。PS:如果您对此有问题,请使用Kobold2D()…包括准备好使用的sneelkyinput。
- (void) initJoystickAndButtons {
    CGSize screen = [CCDirector sharedDirector].winSize;       
    CGRect joystickBaseDimensions = 
    CGRectMake(0, 0, 128.0f, 128.0f);                      
    CGPoint joystickBasePosition;                                  

    joystickBasePosition = ccp(screen.width*0.0625f,
                           screen.height*0.052f);

    SneakyJoystickSkinnedBase *joystickBase =
    [[[SneakyJoystickSkinnedBase alloc] init] autorelease];        
    joystickBase.position = joystickBasePosition;                  
    joystickBase.backgroundSprite = 
        [CCSprite spriteWithFile:@"dpadDown.png"];
    joystickBase.thumbSprite = 
        [CCSprite spriteWithFile:@"joystickDown.png"];                 // 8
    joystickBase.joystick = [[SneakyJoystick alloc]
                     initWithRect:joystickBaseDimensions]; // 9
    leftJoystick = [joystickBase.joystick retain];                // 10
    [self addChild:joystickBase];
}

- (void) applyJoystick:(SneakyJoystick *)aJoystick toNode:(CCNode *)tempNode forTimeDelta (float)deltaTime {
    CGPoint scaledVelocity = ccpMult(aJoystick.velocity, 1024.0f); // 1

    CGPoint newPosition = 
    ccp(tempNode.position.x + scaledVelocity.x * deltaTime, 
        tempNode.position.y + scaledVelocity.y * deltaTime);       // 2

    [tempNode setPosition:newPosition];                            // 3
}

#pragma mark -
#pragma mark Update Method
- (void) update:(ccTime)deltaTime {
    [self applyJoystick:leftJoystick toNode:player forTimeDelta:deltaTime];
}