关于在Xcode上cocos2dx setcolor的setPosition内存错误,为什么

【IOS-COCOS2D-X 游戏开发之十四】XCODE中C++&OBJECT-C混编,详细介绍如何在COCOS2DX中访问OBJECT函数以及APPLE API
【IOS-COCOS2D-X 游戏开发之十四】XCODE中C++&OBJECT-C混编,详细介绍如何在COCOS2DX中访问OBJECT函数以及APPLE API
本站文章均为 李华明Himi 原创,转载务必在明显处注明: 转载自【黑米GameDev街区】 原文链接: http://www.himigame.com/iphone-cocos2dx/743.html
Cocos2dx系列博文的上一篇详细介绍了如何在Xcode中利用jni调用Android的...
本站文章均为
原创,转载务必在明显处注明: 转载自【黑米GameDev街区】 原文链接:
Cocos2dx系列博文的上一篇详细介绍了如何在Xcode中利用jni调用Android的Java层代码,还没有看过的童鞋,请移步到如下博文:
本篇继续介绍另外一个在Cocos2dx中必经之路:在Cocos2dx中调用苹果Api以实现后期iOS的GameCenter和iap的相关操作, 那么Himi这里就跟大家简单分享探讨下;如何在Xcode中进行c++与oc混编吧~
参考王哥说的 SimpleAudioEngine 类;
首先Himi建立了两个类,一个object-c ,一个c++,详细如下:
HSpriteOC.h
HSpriteOC.h
Created by Himi
on 12-4-10.
Copyright (c) 2012年 Himi. All rights reserved.
#import &Foundation/Foundation.h&
NSString * str;
@interface HSpriteOC
+(void) testLog;
+(void) testLogWithStr:(NSString*)_str;
+(void) hMessageBox:(NSString*)pszMsg title:(NSString*)pszTitle;
HSpriteOC.m
Created by Himi on 12-4-10.
Copyright (c) 2012年 Himi. All rights reserved.
#import "HSpriteOC.h"
@implementation HSpriteOC
+(void) testLog{
str = @"Himi-&string is: ";
NSLog(@"HSprite: testLog");
+(void) testLogWithStr:(NSString*)_str{
str = [NSString stringWithFormat:@"%@%@",str,_str];
NSLog(@"%@",str);
+(void) hMessageBox:(NSString*)pszMsg title:(NSString*)pszTitle{
UIAlertView * messageBox = [[UIAlertView alloc] initWithTitle: pszTitle
message: pszMsg
delegate: nil
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[messageBox autorelease];
[messageBox show];
这个类比较简单,简单定义了几个静态函数,打印和显示一个提示框,不赘述,大家大概看下就可以了;
下面来看c++的类:
HSpriteCPP.h
HSpriteCPP.h
Created by Himi on 12-4-10.
Copyright (c) 2012年 Himi. All rights reserved.
#ifndef Oc_Cpp_HSprite_h
#define Oc_Cpp_HSprite_h
#include "cocos2d.h"
using namespace cocos2d;
class HSpriteCPP:public cocos2d::CCSprite {
static HSpriteCPP* hspriteWithFile(const char *spName);
void myInit();
virtual ~HSpriteCPP();
HSpriteCPP.cpp
HSpriteCPP.mm
Created by Himi on 12-4-10.
Copyright (c) 2012年 Himi. All rights reserved.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "HSpriteOC.h"
#include "HSpriteCPP.h"
HSpriteCPP* HSpriteCPP::hspriteWithFile(const char *spName)
HSpriteCPP *pobSprite = new HSpriteCPP();
if (pobSprite && pobSprite->initWithFile(spName))
pobSprite->myInit();
pobSprite->autorelease();
return pobSprite;
CC_SAFE_DELETE(pobSprite);
return NULL;
void HSpriteCPP::myInit(){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
[HSpriteOC testLog];
[HSpriteOC testLogWithStr:@"wahaha"];
[HSpriteOC hMessageBox:@"cocos2dx调用oc函数" title:@"Himi"];
//Android代码
HSpriteCPP::~HSpriteCPP(){
此类是个自定义精灵类,都是简单的创建等函数,其HSprite.cpp类的导入和在 myInit() 自定义初始化函数中都加入了预编译(#if #else #endif 对预编译不太了解的自定百度下吧),主要为了区别当前手机设备的平台区分做处理;而且在myInit()中我使用了object-c语法进行调用之前OC写的HSprite类函数;
其实通过观察以上两个类童鞋们估计很容易看出在xcode中cpp和oc如何混编;其实就是两点:
1. 混编的类需要将其实现类(.cpp)改成(.mm)类,那么Xcode就会智能知道这个类混编类了,不用复杂的操作;
2. 混编中cpp调用oc,其实就是各自使用各自语法即可,没差异!(最好对OC和c++都比较熟悉更效率)
然后Himi在HelloWorldScene.cpp中加入以下测试代码:
HSpriteCPP * sp =HSpriteCPP::hspriteWithFile("Icon.png");
sp->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width*0.5,CCDirector::sharedDirector()->getWinSize().height*0.5-100));
this->addChild(sp);
别忘记导入对应使用的类哦~OK,看运行效果:
用云栖社区APP,舒服~
【云栖快讯】直播推荐——现在报名3月12日编程语言系列讲座,与行业资深专家一起学习Python、C++、JavaScript、Java!还可在活动页面领取红包,百分百中奖哦!&&
文章2301篇
以阿里云成熟的商业化云服务为基础,为游戏开发者、运营企业提供专属集群、尊享VIP服务、专项扶...
阿里云移动APP解决方案,助力开发者轻松应对移动app中随时可能出现的用户数量的爆发式增长、...
是基于语音识别、语音合成、自然语言理解等技术,为企业在多种实际应用场景下,赋予产品“能听、会...
为您提供简单高效、处理能力可弹性伸缩的计算服务,帮助您快速构建更稳定、安全的应用,提升运维效...cocos2d-x-2.2 Run error in xcode
03:11:58 UTC
Ld /Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Products/Debug-iphoneos/SmallBeeClient.app/SmallBeeClient normal armv7
cd /Users/zhyang/Desktop/Cocos2DXEngine/cocos2d-x-2.2/projects/SmallBeeClient/proj.ios
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH “/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin”
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Products/Debug-iphoneos -L/Users/zhyang/Desktop/Cocos2DXEngine/cocos2d-x-2.2/projects/SmallBeeClient/proj.ios/…/…/…/cocos2dx/platform/third_party/ios/libraries -L/Users/zhyang/Desktop/Cocos2DXEngine/cocos2d-x-2.2/projects/SmallBeeClient/proj.ios/…/…/…/external/libwebsockets/ios/lib -F/Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Products/Debug-iphoneos -filelist /Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Intermediates/SmallBeeClient.build/Debug-iphoneos/SmallBeeClient.build/Objects-normal/armv7/SmallBeeClient.LinkFileList -dead_strip -fobjc-link-runtime -miphoneos-version-min=6.0 /Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Products/Debug-iphoneos/libcocos2dx.a -lcurl -framework Foundation -framework UIKit -framework CoreGraphics -framework OpenGLES -lxml2 -lz -framework QuartzCore -framework OpenAL -framework AVFoundation -framework AudioToolbox -lwebsockets -Xlinker -dependency_info -Xlinker /Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Intermediates/SmallBeeClient.build/Debug-iphoneos/SmallBeeClient.build/Objects-normal/armv7/SmallBeeClient_dependency_info.dat -o /Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Products/Debug-iphoneos/SmallBeeClient.app/SmallBeeClient
ld: warning: ignoring file /Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Products/Debug-iphoneos/libcocos2dx.a, file was built for archive which is not the architecture being linked (armv7): /Users/zhyang/Library/Developer/Xcode/DerivedData/SmallBeeClient-hasacfrzjjjoiadkzizgzjlmqedg/Build/Products/Debug-iphoneos/libcocos2dx.a
Undefined symbols for architecture armv7:
“cocos2d::CCPoint::CCPoint()”, referenced from:
__GLOBAL__I_a in CCColliderDetector.o
__GLOBAL__I_a in CCTransformHelp.o
"cocos2d::CCObject::CCObject()", referenced from:
cocos2d::extension::CCBaseData::CCBaseData() in CCDatas.o
"cocos2d::CCApplication::sharedApplication()", referenced from:
-[AppController application:didFinishLaunchingWithOptions:] in AppController.o
-[AppController applicationDidEnterBackground:] in AppController.o
-[AppController applicationWillEnterForeground:] in AppController.o
"typeinfo for cocos2d::CCLayer", referenced from:
typeinfo for HelloWorld in HelloWorldScene.o
"cocos2d::CCCopying::copyWithZone(cocos2d::CCZone*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
vtable for cocos2d::extension::CCBaseData in CCDatas.o
"cocos2d::CCNode::setVertexZ(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getScaleY()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setPosition(cocos2d::CCPoint const&)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getPosition()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"typeinfo for cocos2d::CCObject", referenced from:
typeinfo for cocos2d::extension::CCBaseData in CCDatas.o
"cocos2d::CCNode::getPosition(float*, float*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getAnchorPoint()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setContentSize(cocos2d::CCSize const&)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::isVisible()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setRotation(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setRotationX(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setPositionX(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getRotationX()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setPositionY(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getRotationY()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setOrderOfArrival(unsigned int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getOrderOfArrival()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setGLServerState(cocos2d::ccGLServerState)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCObject::acceptVisitor(cocos2d::CCDataVisitor&)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
vtable for cocos2d::extension::CCBaseData in CCDatas.o
"cocos2d::CCNode::getGLServerState()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::addChild(cocos2d::CCNode*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::addChild(cocos2d::CCNode*, int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::addChild(cocos2d::CCNode*, int, int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getChildren()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeFromParent()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getContentSize() const", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeFromParentAndCleanup(bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeChild(cocos2d::CCNode*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setScaleY(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getPositionY()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeChild(cocos2d::CCNode*, bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeAllChildren()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeAllChildrenWithCleanup(bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::reorderChild(cocos2d::CCNode*, int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setAnchorPoint(cocos2d::CCPoint const&)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::sortAllChildren()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setGrid(cocos2d::CCGridBase*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setTag(int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getAnchorPointInPoints()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getUserObject()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getUserData()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setPosition(float, float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setParent(cocos2d::CCNode*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setUserData(void*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getCamera()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::unregisterScriptHandler()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getActionManager()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setScheduler(cocos2d::CCScheduler*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getScheduler()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::updateTransform()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::cleanup()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchEnded(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::onEnter()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::nodeToParentTransform()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCRect::CCRect(float, float, float, float)", referenced from:
__GLOBAL__I_a in CCBAnimationManager.o
__GLOBAL__I_a in CCBFileLoader.o
__GLOBAL__I_a in CCBKeyframe.o
__GLOBAL__I_a in CCBReader.o
__GLOBAL__I_a in CCBSequence.o
__GLOBAL__I_a in CCBSequenceProperty.o
__GLOBAL__I_a in CCBValue.o
“cocos2d::CCNode::worldToNodeTransform()”, referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCDirector::runWithScene(cocos2d::CCScene*)", referenced from:
AppDelegate::applicationDidFinishLaunching() in AppDelegate.o
"cocos2d::CCNode::removeComponent(char const*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getZOrder()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeAllComponents()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getVertexZ()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::isIgnoreAnchorPointForPosition()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::ccTouchBegan(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::ccTouchesBegan(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCScriptEngineManager::sharedManager()", referenced from:
-[EditBoxImplIOS textFieldShouldBeginEditing:] in CCEditBoxImplIOS.o
-[EditBoxImplIOS textFieldShouldEndEditing:] in CCEditBoxImplIOS.o
-[EditBoxImplIOS textChanged] in CCEditBoxImplIOS.o
"cocos2d::CCLayer::ccTouchesCancelled(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCApplication::run()", referenced from:
-[AppController application:didFinishLaunchingWithOptions:] in AppController.o
"cocos2d::CCNode::registerScriptHandler(int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setSkewY(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getSkewY()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::registerWithTouchDispatcher()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::unregisterScriptTouchHandler()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::_setZOrder(int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::setTouchEnabled(bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::ccTouchesMoved(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::ccTouchCancelled(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::setTouchMode(cocos2d::ccTouchesMode)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::getTouchMode()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::setTouchPriority(int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::setAccelerometerInterval(double)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::getTouchPriority()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"non-virtual thunk to cocos2d::CCLayer::keyBackClicked()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::ccTouchMoved(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::registerScriptTouchHandler(int, bool, int, bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::setKeypadEnabled(bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCApplication::CCApplication()", referenced from:
AppDelegate::AppDelegate() in AppDelegate.o
"cocos2d::CCLayer::isAccelerometerEnabled()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::keyBackClicked()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::keyMenuClicked()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchBegan(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setShaderProgram(cocos2d::CCGLProgram*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchCancelled(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setSkewX(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getSkewX()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getRotation()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::setAccelerometerEnabled(bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCDirector::resume()", referenced from:
-[AppController applicationDidBecomeActive:] in AppController.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getScaleX()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setVisible(bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCPoint::CCPoint(float, float)", referenced from:
__GLOBAL__I_a in CCBAnimationManager.o
__GLOBAL__I_a in CCBFileLoader.o
__GLOBAL__I_a in CCBKeyframe.o
__GLOBAL__I_a in CCBReader.o
__GLOBAL__I_a in CCBSequence.o
__GLOBAL__I_a in CCBSequenceProperty.o
__GLOBAL__I_a in CCBValue.o
“cocos2d::CCDirector::pause()”, referenced from:
-[AppController applicationWillResignActive:] in AppController.o
"OBJC_CLASS$_EAGLView", referenced from:
objc-class-ref in CCEditBoxImplIOS.o
objc-class-ref in AppController.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchesCancelled(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setZOrder(int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::onExit()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::nodeToWorldTransform()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::ccTouchEnded(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::isKeypadEnabled()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCObject::isEqual(cocos2d::CCObject const*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
vtable for cocos2d::extension::CCBaseData in CCDatas.o
"cocos2d::CCNode::isRunning()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCApplication::getTargetPlatform()", referenced from:
vtable for AppDelegate in AppDelegate.o
"non-virtual thunk to cocos2d::CCLayer::didAccelerate(cocos2d::CCAcceleration*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setScale(float, float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getGrid()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCDirector::getVisibleOrigin()", referenced from:
HelloWorld::init() in HelloWorldScene.o
"non-virtual thunk to cocos2d::CCLayer::keyMenuClicked()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::CCLayer()", referenced from:
HelloWorld::create() in HelloWorldScene.o
"cocos2d::CCMenu::create(cocos2d::CCMenuItem*, …)", referenced from:
HelloWorld::init() in HelloWorldScene.o
"cocos2d::CCNode::getShaderProgram()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::addComponent(cocos2d::CCComponent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setRotationY(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCDirector::end()", referenced from:
HelloWorld::menuCloseCallback(cocos2d::CCObject*) in HelloWorldScene.o
"cocos2d::CCLayer::init()", referenced from:
HelloWorld::init() in HelloWorldScene.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchMoved(cocos2d::CCTouch*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setScale(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getScale()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCDirector::setOpenGLView(cocos2d::CCEGLView*)", referenced from:
AppDelegate::applicationDidFinishLaunching() in AppDelegate.o
"cocos2d::CCLayer::didAccelerate(cocos2d::CCAcceleration*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setActionManager(cocos2d::CCActionManager*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeChildByTag(int, bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::~CCLayer()", referenced from:
HelloWorld::~HelloWorld() in HelloWorldScene.o
HelloWorld::~HelloWorld() in HelloWorldScene.o
non-virtual thunk to HelloWorld::~HelloWorld() in HelloWorldScene.o
non-virtual thunk to HelloWorld::~HelloWorld() in HelloWorldScene.o
"cocos2d::CCObject::~CCObject()", referenced from:
cocos2d::extension::CCBaseData::~CCBaseData() in CCDatas.o
cocos2d::extension::CCBaseData::~CCBaseData() in CCDatas.o
"cocos2d::CCNode::parentToNodeTransform()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCScene::create()", referenced from:
HelloWorld::scene() in HelloWorldScene.o
"cocos2d::CCMenuItemImage::create(char const*, char const*, cocos2d::CCObject*, void (cocos2d::CCObject::)(cocos2d::CCObject))", referenced from:
HelloWorld::init() in HelloWorldScene.o
"cocos2d::CCNode::setUserObject(cocos2d::CCObject*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::isTouchEnabled()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCObject::autorelease()", referenced from:
HelloWorld::create() in HelloWorldScene.o
"cocos2d::CCNode::draw()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCApplication::setAnimationInterval(double)", referenced from:
vtable for AppDelegate in AppDelegate.o
"cocos2d::CCLabelTTF::create(char const*, char const*, float)", referenced from:
HelloWorld::init() in HelloWorldScene.o
"cocos2d::CCDirector::getVisibleSize()", referenced from:
HelloWorld::init() in HelloWorldScene.o
"cocos2d::CCApplication::~CCApplication()", referenced from:
AppDelegate::~AppDelegate() in AppDelegate.o
AppDelegate::~AppDelegate() in AppDelegate.o
"cocos2d::CCApplication::getCurrentLanguage()", referenced from:
vtable for AppDelegate in AppDelegate.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchesBegan(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getTag() const", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::onExitTransitionDidStart()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCLayer::onEnterTransitionDidFinish()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCDirector::sharedDirector()", referenced from:
AppDelegate::applicationDidFinishLaunching() in AppDelegate.o
AppDelegate::applicationDidEnterBackground() in AppDelegate.o
AppDelegate::applicationWillEnterForeground() in AppDelegate.o
HelloWorld::init() in HelloWorldScene.o
HelloWorld::menuCloseCallback(cocos2d::CCObject*) in HelloWorldScene.o
-[AppController applicationWillResignActive:] in AppController.o
-[AppController applicationDidBecomeActive:] in AppController.o
“cocos2d::CCEGLViewProtocol::getScaleX() const”, referenced from:
-[CustomUITextField textRectForBounds:] in CCEditBoxImplIOS.o
"cocos2d::CCSprite::create(char const*)", referenced from:
HelloWorld::init() in HelloWorldScene.o
"cocos2d::CCNode::ignoreAnchorPointForPosition(bool)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCSize::CCSize(float, float)", referenced from:
__GLOBAL__I_a in CCBAnimationManager.o
__GLOBAL__I_a in CCBFileLoader.o
__GLOBAL__I_a in CCBKeyframe.o
__GLOBAL__I_a in CCBReader.o
__GLOBAL__I_a in CCBSequence.o
__GLOBAL__I_a in CCBSequenceProperty.o
__GLOBAL__I_a in CCBValue.o
“cocos2d::CCLayer::ccTouchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*)”, referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCEGLView::sharedOpenGLView()", referenced from:
-[CustomUITextField textRectForBounds:] in CCEditBoxImplIOS.o
AppDelegate::applicationDidFinishLaunching() in AppDelegate.o
"cocos2d::CCNode::getParent()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::visit()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::update(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"non-virtual thunk to cocos2d::CCLayer::ccTouchesMoved(cocos2d::CCSet*, cocos2d::CCEvent*)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::setScaleX(float)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::getPositionX()", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"cocos2d::CCNode::removeChildByTag(int)", referenced from:
vtable for HelloWorld in HelloWorldScene.o
"typeinfo for cocos2d::CCApplication", referenced from:
typeinfo for AppDelegate in AppDelegate.o
"cocos2d::CCLog(char const*, …)", referenced from:
-[EditBoxImplIOS textFieldShouldBeginEditing:] in CCEditBoxImplIOS.o
-[EditBoxImplIOS textFieldShouldEndEditing:] in CCEditBoxImplIOS.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 notices only
===========================
The above is incorrect , please come out under the guidance of experts . Thank you
My macOSX Version is 10.8.5 and Xcode Version is 5.0 and iPhone5 Version is ios7
08:54:09 UTC
I think you haven’t linked to cocos2d static library correctly. It seems that “ld” can’t find all symbols of cocos2d standard interfaces.
09:31:18 UTC
!Hello zhe wang, I follow the steps to create , as shown.
12:51:37 UTC
I have the same problem. HOWEVER, I think this is a bigger problem than just linking.
All the links in the .xcodeproj files are relative to the creation directory. I often move my projects around or create them in a specific location so my configuration management (SVN) has them automatically added. Only creating them in the projects directory as the script does is not a good option. If they could be installed as xcode templates as they were in the past, that would be good because I could choose where the installation will be.
The cocos2d-x build should NOT be a library. If I make a modification to the code base in one project and it is stored in a common place, then all projects pick it up. All the other frameworks (Box2D, Denshion) are in the project and are not libraries, and this is good because they get changed locally as well. If the developer wants to have a library, they should be able to choose it. The method in the previous release worked very well. PLEASE DO NOT CHANGE THE MODEL. This makes it more complicated and easy to break.
I was trying out 2.2 before starting a new project with it. I cannot use it in its current form.
16:24:39 UTC
I met the same error, and my developed environment is Xcode 5.0 and cocos2d-x 2.2.0. Maybe yours is same.
But I found that the error appeared when the “deployment target” was set 7.0, and the project worked at 6.1, 6.0 and 5.1(I didn’t try 5.0 and 4.3).
Try my way please, and post the result if it worked.
19:56:42 UTC
I have verified your result, Hongjun. I also have XCode 5.0 and was trying the 2.2.0 release. When I set the “deployment target” to anything other than 7.0, it appears to build properly. When set to 7.0, it gets link errors.
20:00:41 UTC
Perhaps the best solution is to copy the entire 2.2.0 iOS code base directly into the build (as it was in the past) and not build it as a library. I think this is a good idea, as you may then alter the 2.2.0 code base for a specific application without having to worry about compromising other applications that derive from it. I will try this.
It would still be better if an Xcode 5 template set could be generated and installed via a script. This was very effective in the past. I am not against change, but it has to have value and not slow down the process of development merely for the sake of change.
00:45:42 UTC
James Wucher wrote:
Perhaps the best solution is to copy the entire 2.2.0 iOS code base directly into the build (as it was in the past) and not build it as a library. I think this is a good idea, as you may then alter the 2.2.0 code base for a specific application without having to worry about compromising other applications that derive from it. I will try this.
It would still be better if an Xcode 5 template set could be generated and installed via a script. This was very effective in the past. I am not against change, but it has to have value and not slow down the process of development merely for the sake of change.
Thank you James.
06:57:10 UTC
This is my way -
In page “Build Settings” of Xcode, search “ONLY_ACTIVE_ARCH”.
Turn “Build Active Architecture Only” to “No”.
Both debug and release, both your project and cocos2dx.xcodeproj, close it.
It work fine for me.
03:50:58 UTC
Shawn Clovie wrote:
This is my way -
In page “Build Settings” of Xcode, search “ONLY_ACTIVE_ARCH”.
Turn “Build Active Architecture Only” to “No”.
Both debug and release, both your project and cocos2dx.xcodeproj, close it.
It work fine for me.
This works for me too.But some other link error still exist,seems about std::string.
Undefined symbols for architecture armv7:
“std::string::copy(char*, unsigned long, unsigned long) const", referenced from:
cocos2d::CCNotificationObserver::CCNotificationObserver, char const**, cocos2d::CCObject*) in libcocos2dx.a(CCNotificationCenter.o)
”std::*Rb_tree_rebalance_for_erase(std::*Rb_tree_node_base*, std::*Rb_tree_node_base&)", referenced from:
std::*Rb_tree&std::string, std::string, std::_Identitystd::string, std::lessstd::string, std::allocatorstd::string &::erase in libcocos2dx.a
19:09:58 UTC
Did you solve this error? I use v3.0 and getting stuck here.
My class is below. Anytime I call function createWithFrame(…), I got that error “Undefined symbols for architecture armv7” :;angry I tried a lot of solution when google but not solve it yet.
#include &cocos2d.h&
class AnimationHelper : public cocos2d::Animation
static cocos2d::Animation* createWithFrame(std::string frameName, int frameCount, float delay);
#include "AnimationHelper.h"
// Creates an animation from sprite frames.
cocos2d::Animation* createWithFrame(std::string frameName, int frameCount, float delay)
// load the ship's animation frames as textures and create a sprite frame
cocos2d::Vector&cocos2d::SpriteFrame*& frames = cocos2d::Vector&cocos2d::SpriteFrame*&(frameCount);
for (int i = 0; i & frameC i++)
std::string file = cocos2d::StringUtils::format("%s%i.png", frameName.c_str(), i);
cocos2d::SpriteFrameCache *frameCache = cocos2d::SpriteFrameCache::getInstance();
cocos2d::SpriteFrame *frame = frameCache-&getSpriteFrameByName(file);
frames.pushBack(frame);
// return an animation object from all the sprite animation frames
return cocos2d::Animation::createWithSpriteFrames(frames, delay);
03:28:54 UTC
change you
cocos2d::Animation* createWithFrame(std::string frameName, int frameCount, float delay)
cocos2d::Animation* AnimationHelper::createWithFrame(std::string frameName, int frameCount, float delay)

我要回帖

更多关于 cocos2dx setscale 的文章

 

随机推荐