#问题引出
##在使用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)没有添加引用。
##特此记录