xcode编译错误
错误收集:
1
no matching function for call to `xushu::set(xushu)'
就是说编译器没有找到签名为 xushu::set(xushu)的函数。要么是函数写错了,要么是调用的时候写错了。
2
cannot call member function 'char* CCAnimation1::format(char*, ...)' without object
要用一个对象来调用函数
3
警告:
control reaches end of non-void function
到了函数结尾还没有返回值 需要有返回值
4
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1
5
duplicate symbol Level::loadData() in /Users/anyanyone/Library/Developer/Xcode/DerivedData/NewBulkNinja-gyytdvkxivkrqkbuxekucuokhbum/Build/Intermediates/NewBulkNinja.build/Debug-iphonesimulator/NewBulkNinja.build/Objects-normal/i386/LevelTime.o and /Users/anyanyone/Library/Developer/Xcode/DerivedData/NewBulkNinja-gyytdvkxivkrqkbuxekucuokhbum/Build/Intermediates/NewBulkNinja.build/Debug-iphonesimulator/NewBulkNinja.build/Objects-normal/i386/Level.o for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1
6.
SIGABRT 一般是过度release 或者 发送 unrecogized selector (调用了不存在的方法)导致
EXC_BAD_ACCESS 是访问已被释放的内存导致
7.
fatal error: file '/Applications/Xcode5-DP.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDynamicAnimator.h' has been modified since the precompiled header '/Users/sumomochuufuku/Library/Developer/Xcode/DerivedData/ModuleCache/2NEVAP7X943D2/UIKit.pcm' was built
note: after modifying system headers, please delete the module cache at '/Users/sumomochuufuku/Library/Developer/Xcode/DerivedData/ModuleCache/2NEVAP7X943D2'
1 error generated.
解决办法:前往 '/Users/sumomochuufuku/Library/Developer/Xcode/DerivedData/ModuleCache/2NEVAP7X943D2 这个文件夹,删除其文件夹中的内容,然后运行app,没问题了,注意不是删除 2NEVAP7X943D2 文件夹,而是其中的内容。然后再 clean下项目就可以了(product -> clean)
注意:
1)、 sumomochuufuku 是我的用户名,你要改成你自己的。
2)、NEVAP7X943D2 文件夹应该是对应应用的,所以会随着app的不同而改变,要理解并灵活使用。
8.
编译错误:
提示libcurl.a文件 cocos2d-x-2.2.2/cocos2dx/platform/third_party/ios/libraries
libwebsocket.a cocos2d-x-2.2.2/external/libwebsockets/ios/lib
9.
Undefined symbols for architecture i386:
"GSGGUI_2_0_0::loadLayoutWithDelegate(Json::Value, GSGGUILoadLayoutDelegate*)", referenced from:
GSGGUILayoutManager::loadLayoutWithFile(cocos2d::CCString*, GSGGUILoadLayoutDelegate*) in GSGGUILayoutManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决:loadLayoutWithDelegate只有声明没有实现
10.
constructor for 'GSGBounceButton' must explicitly initialize the number
类声明需要这样初始化
GSGBounceButton::GSGBounceButton():
m_scaleDuration(0),
m_normalScale(0),
m_smallScale(0),
m_verticalPadding(0),
m_horizontalPadding(0),
m_enabled(0)
11. ambiguous conversion from derived class”GUIParticleNode”to base class ‘coocs2d::CCCopying’
class GUIParticleNode : public CCCopying
这种继承的话 写CCCopying::copyWithZone(NULL);不报错
class GUIParticleNode : public CCCopying, CCNode
这样写CCCopying::copyWithZone(NULL);报错
解决:因为class CC_DLL CCNode : public CCObject
class CC_DLL CCObject : public CCCopying
重复继承了所以报错
12.
dynamic_cast<CCObject*>(pDelegate)->retain();
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, kCCMenuHandlerPriority, true);
报错
解决:
class GSGBounceButton:public CCNode, CCTouchDelegate
改为
class GSGBounceButton:public CCNode, public CCTouchDelegate
默认是私有继承
13.
call to non-static member function without an object argument
解决方法:
1.)把调用的方法声明为static
2.)把方法所在的类作为第一个继承
14.
invalid use of ‘this’ outside of a non-static member function
解决:
方法前面没有加引用域(少了MJTheme::)
CCNode* MJTheme::createNodeFromDictionary(CCDictionary* nodeDef, OFInAppPurchase* sku)
15.
Undefined symbols for architecture i386:
"ThemeManager::sharedInstance()", referenced from:
Game::loadWorld() in Game.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbols for architecture i386:
"ThemeManager::sharedInstance()", referenced from:
Game::loadWorld() in Game.o
解决方法一:
在Game::loadWorld()的方法里面调用了ThemeManager::sharedInstance()函数,但是sharedInstance()没有实现