链接中省略了静态库

时间:2012-06-08 02:35:28

标签: iphone xcode

关于链接静态库

我有一些问题

我添加了一个静态库构建目标。 并添加了链接库列表。  enter image description here

但是发生了链接错误。我认为命令中没有-lCocosDenshion标志。 enter image description here

我为所有构建目标设置了“有效架构”为“VALID_ARCHS = armv6 armv7 i386”。

以下是有关此活动的完整日志。 我需要你的帮助。谢谢你的帮助!

Ld /Users/tae1560/Library/Developer/Xcode/DerivedData/HelloWorld-avkpbeubpocaklejnbukdyudocwz/Build/Products/Debug-iphonesimulator/HelloWorld.app/HelloWorld normal i386
cd /Users/tae1560/Documents/Projects/daegu/HelloWorld/ios
setenv MACOSX_DEPLOYMENT_TARGET 10.6
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/iPhoneSimulator5.1.sdk -L/Users/tae1560/Library/Developer/Xcode/DerivedData/HelloWorld-avkpbeubpocaklejnbukdyudocwz/Build/Products/Debug-iphonesimulator -F/Users/tae1560/Library/Developer/Xcode/DerivedData/HelloWorld-avkpbeubpocaklejnbukdyudocwz/Build/Products/Debug-iphonesimulator -filelist /Users/tae1560/Library/Developer/Xcode/DerivedData/HelloWorld-avkpbeubpocaklejnbukdyudocwz/Build/Intermediates/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Objects-normal/i386/HelloWorld.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -framework Foundation -framework UIKit -framework CoreGraphics -lcocos2d -framework OpenGLES -lxml2 -lz -framework QuartzCore -o /Users/tae1560/Library/Developer/Xcode/DerivedData/HelloWorld-avkpbeubpocaklejnbukdyudocwz/Build/Products/Debug-iphonesimulator/HelloWorld.app/HelloWorld
Undefined symbols for architecture i386:
"CocosDenshion::SimpleAudioEngine::sharedEngine()", referenced from:
  Episode1Scene::init() in Episode1Scene.o
  Episode2Scene::init() in Episode2Scene.o
  Episode3Scene::init() in Episode3Scene.o
  Episode4Scene::init() in Episode4Scene.o
  Episode5Scene::init() in Episode5Scene.o
  Episode6Scene::init() in Episode6Scene.o
  MenuScene::init() in MenuScene.o
  ...
"CocosDenshion::SimpleAudioEngine::playBackgroundMusic(char const*, bool)", referenced from:
  Episode1Scene::init() in Episode1Scene.o
  Episode2Scene::init() in Episode2Scene.o
  Episode3Scene::init() in Episode3Scene.o
  Episode4Scene::init() in Episode4Scene.o
  Episode5Scene::init() in Episode5Scene.o
  Episode6Scene::init() in Episode6Scene.o
  MenuScene::init() in MenuScene.o
  ...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

2 个答案:

答案 0 :(得分:0)

您是否尝试手动将其添加到链接器标志?

如果添加它没有帮助,您可能需要确保文件位于正确的位置,并将其路径添加到标题搜索路径!

如果这也不起作用,您只需将CocosDenshion库作为源代码拖动并完成整个问题。但那可能不是你想要的。

答案 1 :(得分:0)

您需要在项目中添加CocosDenshion文件夹。然后你需要像

这样的框架
AudioToolbox.framework
AVFoundation.framework
OpenAL.framework