0
我嘗試添加TCMPortMapper時(http://code.google.com/p/tcmportmapper/)錯誤導入框架的Objective-C
我已經鏈接的框架的構建階段,並試圖運行示例代碼:
#import <Foundation/Foundation.h>
#import <TCMPortMapper/TCMPortMapper.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
TCMPortMapper *pm = [TCMPortMapper sharedInstance];
[pm addPortMapping:
[TCMPortMapping portMappingWithLocalPort:13478
desiredExternalPort:4321
transportProtocol:TCMPortMappingTransportProtocolTCP
userInfo:nil]];
[pm start];
[pool drain];
return 0;
}
,但我得到的錯誤:
ld: warning: ignoring file /Applications/TCMPortMapper.framework/TCMPortMapper, missing required
architecture x86_64 in file
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_TCMPortMapper", referenced from:
objc-class-ref in main.o
"_OBJC_CLASS_$_TCMPortMapping", referenced from:
objc-class-ref in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
即時猜測它是與框架,而不是我。但是我花了很多時間搜索 ,除了它可能是32位和64位模式以外,沒有多少發現。
任何幫助將非常感激,因爲我一直堅持這個爲期3天。
感謝, 威爾
很可能OP已經在構建i386和x86_64。 OP可以從構建設置中刪除x86_64體系結構,強制他們的機器運行i386體系結構,但構建i386/x86_64通用版本的框架將是更好的解決方案。 – 2011-06-02 21:21:11
還將部署目標設置爲10.5或10.4會更好。 – 2011-06-02 21:25:11