开发者

Error when importing framework objective-c

I am trying to add TCMPortMapper (http://code.google.com/p/tcmportmapper/)

I have linked the framework in the build phases and tried to run the example code:

#import <Foundation/Foundation.h>
#import <TCMPortMapper/TCMPortMapper.h>
int main (int argc, const char * argv[])

{

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    TCMPortMapper *pm = [TCMPortMapper sharedIns开发者_Python百科tance];
    [pm addPortMapping:
    [TCMPortMapping portMappingWithLocalPort:13478 
                         desiredExternalPort:4321 
                           transportProtocol:TCMPortMappingTransportProtocolTCP
                                    userInfo:nil]];
    [pm start];

    [pool drain];
    return 0;
}

but I get the error :

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)

Im guessing it has something to do with the framework, not me. But I've spent a lot of time googling and haven't turned up much except it might be something with 32 and 64 bit modes.

Any help would be very much appreciated because I've been stuck on this for 3 days.

Thanks, Will


Are you using the binary release of TCPPortMapper? It doesn't have x86_64 arch executable.

$ file TCMPortMapper.framework/TCMPortMapper
TCMPortMapper.framework/TCMPortMapper: Mach-O universal binary with 2 architectures
TCMPortMapper.framework/TCMPortMapper (for architecture ppc):   Mach-O dynamically linked shared library ppc
TCMPortMapper.framework/TCMPortMapper (for architecture i386):  Mach-O dynamically linked shared library i386

Add GCC "-m32" or "-arch i386" option to CFLAGS and LDFLAGS, or build TCPPortMapper yourself for x86_64 arch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜