3

我在我的项目中使用 GHUnit,但是当我尝试运行该应用程序时出现错误

ld /Users/goldfire/Library/Developer/Xcode/DerivedData/WhatsMySpeed-amkgqintxyhelabqvrpouivmdglf/Build/Products/Debug-iphonesimulator/GHUnitTests.app/GHUnitTests normal i386 cd /Users/goldfire/Desktop/Example/WhatsMySpeed 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/goldfire/Library/Developer/Xcode/DerivedData/WhatsMySpeed-amkgqintxyhelabqvrpouivmdglf/Build/Products/Debug-iphonesimulator -F/Users/goldfire/Library/Developer/Xcode/DerivedData/WhatsMySpeed-amkgqintxyhelabqvrpouivmdglf/Build/Products/ Debug-iphonesimulator -F/Users/goldfire/Desktop/Example/WhatsMySpeed -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/goldfire/Library/Developer/Xcode/DerivedData/WhatsMySpeed-amkgqintxyhelabqvrpouivmdglf/构建/中间体/WhatsMySpeed.build/Debug-iphonesimulator/GHUnitTests.build/Objects-normal/i386/GHUnitTests.LinkFileList -mmacosx-version-min=10。6 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -all_load -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -framework GHUnitIOS -framework SenTestingKit -o /Users/goldfire/Library/Developer/ Xcode/DerivedData/WhatsMySpeed-amkgqintxyhelabqvrpouivmdglf/Build/Products/Debug-iphonesimulator/GHUnitTests.app/GHUnitTests

架构 i386 的未定义符号:“_OBJC_CLASS_$_SenTestCase”,引用自:LogicTests.o 中的 _OBJC_CLASS_$_LogicTests “_OBJC_METACLASS_$_SenTestCase”,引用自:LogicTests.o 中的 _OBJC_METACLASS_$_LogicTests ld:未找到架构 i386 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

4

1 回答 1

7

查看此链接: http: //fstanley.github.com/blog/2012/06/10/fixing-ghunit-sentestcase-link-errors/

基本上你需要添加:

$(SDKROOT)/Developer/Library/Frameworks

$(DEVELOPER_LIBRARY_DIR)/Frameworks

到测试目标设置中的框架搜索路径。

我有同样的错误,这修复了它。

注意:必须按照http://forum.sparrow-framework.org/topic/cant-run-unit-tests的确切顺序添加项目。

于 2012-07-04T01:32:46.350 回答