ld: symbol(s) not found for architecture i386

#问题引出

##在使用xcode运行cocos2d-x应用的时候发现出了这样的错误:

Ld /Users/sjbwybls/Library/Developer/Xcode/DerivedData/MyGame-arludletzetwkseytsepwlnpmgtv/Build/Products/Debug-iphonesimulator/MyGame.app/MyGame normal i386 cd /Users/sjbwybls/cocos2d-x-2.1.4/projects/MyGame/proj.ios setenv IPHONEOS_DEPLOYMENT_TARGET 4.0 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/sjbwybls/Library/Developer/Xcode/DerivedData/MyGame-arludletzetwkseytsepwlnpmgtv/Build/Products/Debug-iphonesimulator -L/Users/sjbwybls/cocos2d-x-2.1.4/projects/MyGame/proj.ios/../../../cocos2dx/platform/third_party/ios/libraries -L/Users/sjbwybls/cocos2d-x-2.1.4/projects/MyGame/proj.ios/../../../external/libwebsockets/ios/lib -F/Users/sjbwybls/Library/Developer/Xcode/DerivedData/MyGame-arludletzetwkseytsepwlnpmgtv/Build/Products/Debug-iphonesimulator -filelist /Users/sjbwybls/Library/Developer/Xcode/DerivedData/MyGame-arludletzetwkseytsepwlnpmgtv/Build/Intermediates/MyGame.build/Debug-iphonesimulator/MyGame.build/Objects-normal/i386/MyGame.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -fobjc-link-runtime -mios-simulator-version-min=4.0 /Users/sjbwybls/Library/Developer/Xcode/DerivedData/MyGame-arludletzetwkseytsepwlnpmgtv/Build/Products/Debug-iphonesimulator/libcocos2dx.a -lcurl -framework Foundation -framework UIKit -framework CoreGraphics -framework OpenGLES -lxml2 -lz -framework QuartzCore -framework OpenAL -framework AVFoundation -framework AudioToolbox -lwebsockets -o /Users/sjbwybls/Library/Developer/Xcode/DerivedData/MyGame-arludletzetwkseytsepwlnpmgtv/Build/Products/Debug-iphonesimulator/MyGame.app/MyGame

Undefined symbols for architecture i386:
"BaseLayer::setBackgroundImage(char const*)", referenced from: Welcome::init() in Welcome.o Welcome::setupViews() in Welcome.o Welcome::create() in Welcome.o Loading::init() in Loading.o Loading::setupViews() in Loading.o Loading::create() in Loading.o Option::init() in Option.o ... "BaseLayer::init()", referenced from: Welcome::init() in Welcome.o Welcome::create() in Welcome.o Loading::init() in Loading.o Loading::create() in Loading.o Option::init() in Option.o Option::create() in Option.o Board::init() in Board.o ... "BaseLayer::BaseLayer()", referenced from: Welcome::Welcome() in Welcome.o Welcome::Welcome() in Welcome.o Welcome::create() in Welcome.o Loading::Loading() in Loading.o Loading::Loading() in Loading.o Loading::create() in Loading.o Option::Option() in Option.o ... "BaseLayer::~BaseLayer()", referenced from: Welcome::~Welcome() in Welcome.o Welcome::~Welcome() in Welcome.o non-virtual thunk to Welcome::~Welcome() in Welcome.o Welcome::~Welcome() in Welcome.o non-virtual thunk to Welcome::~Welcome() in Welcome.o Loading::~Loading() in Loading.o Loading::~Loading() in Loading.o ... "typeinfo for BaseLayer", referenced from: typeinfo for Welcome in Welcome.o typeinfo for Loading in Loading.o typeinfo for Option in Option.o typeinfo for Board in Board.o typeinfo for Game in Game.o typeinfo for Score in Score.o typeinfo for About in About.o ...

ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)

##搞了一阵之后,才发现原来xcode是有一个很严格的引用规定的,也是C++的编译规则,每一个编译的文件都必须在命令行里面,而我只是因为有一个BaseLayer.h(和.cpp)没有添加引用。

##特此记录

转载于:https://my.oschina.net/huami/blog/156482

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值