1

尝试运行单元测试时,我在 XCode 中遇到错误。有任何想法吗?

我尝试将构建设置中的框架搜索路径更改为 $(SDKROOT)/Developer/Library/Frameworks $(DEVELOPER_LIBRARY_DIR)/Frameworks

但这并没有改变什么。

ld: warning: directory not found for option '-F/Applications/Xcode'

ld: warning: directory not found for option '-
F4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Developer/Library/Frameworks'

ld: warning: directory not found for option '-F/Applications/Xcode'

ld: warning: directory not found for option '-F4.3.2.app/Contents/Developer/Library/Frameworks'

ld: warning: ignoring file /Applications/Xcode 4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks//SenTestingKit.framework/SenTestingKit, file was built for unsupported file format which is not the architecture being linked (x86_64)

Undefined symbols for architecture x86_64:
  "_STComposeString", referenced from:
      -[AddressBookFrameworkSyncHelperTest testAddingAPersonToGroupsFromAVcard] in AddressBookFrameworkSyncHelperTest.o
      -[SyncTesting testExample] in SyncTesting.o
  "_OBJC_CLASS_$_SenTestCase", referenced from:
      _OBJC_CLASS_$_AddressBookFrameworkSyncHelperTest in AddressBookFrameworkSyncHelperTest.o
      _OBJC_CLASS_$_SyncTesting in SyncTesting.o
  "_OBJC_CLASS_$_AddressBookFrameworkSyncHelper", referenced from:
      objc-class-ref in AddressBookFrameworkSyncHelperTest.o
     (maybe you meant: _OBJC_CLASS_$_AddressBookFrameworkSyncHelperTest)
  "_OBJC_METACLASS_$_SenTestCase", referenced from:
      _OBJC_METACLASS_$_AddressBookFrameworkSyncHelperTest in AddressBookFrameworkSyncHelperTest.o
      _OBJC_METACLASS_$_SyncTesting in SyncTesting.o

ld: symbol(s) not found for architecture x86_64

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

1 回答 1

3

These error messages show the problem:

ld: warning: directory not found for option '-F/Applications/Xcode'

ld: warning: directory not found for option '-F4.3.2.app/Contents/Developer/Library/Frameworks'

Clearly you've got "/Applications/Xcode" and "4.3.2.app/Contents/Developer/Library/Frameworks" on your frameworks paths separately, instead of "/Applications/Xcode 4.3.2.app/Contents/Developer/Library/Frameworks".

If this is something you did, you're probably missing quotes somewhere. Maybe just doing the exact same thing you tried, but with quotes around it, will work?

If it's something that Xcode is doing automatically, Apple's missing quotes somewhere, and the workaround is probably to rename your "Xcode 4.3.2.app" to something without spaces in it.

But there may be a second problem here as well:

ld: warning: ignoring file /Applications/Xcode 4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks//SenTestingKit.framework/SenTestingKit, file was built for unsupported file format which is not the architecture being linked (x86_64)

In this case, the quotes are right, and it's finding the framework… but apparently you've only got the 32-bit (i386) build installed, not the 64-bit (x86_64) one that you need.

I'm also a bit curious where this came from in the first place, as when I look at the 10.6 SDK in my Xcode 4.3.2, there's no framework called SenTestingKit.framework. Which implies that you may have hacked up your Xcode install in various ways, and the right solution might be to uninstall, reinstall, and do things properly. But it's possible this is some additional install from within Xcode (or from developer.apple.com) that you've installed and I haven't.

于 2012-07-20T21:54:41.397 回答