Ошибка при импорте framework-c - PullRequest
0 голосов
/ 03 июня 2011

Я пытаюсь добавить TCMPortMapper (http://code.google.com/p/tcmportmapper/)

Я связал структуру на этапах сборки и попытался запустить пример кода:

#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)

Полагаю, это как-то связано с фреймворком, а не со мной, но я потратил много времени на поиск в Google и мало что нашел, за исключением того, что это может быть что-то с 32- и 64-битными режимами.

Любая помощь будет очень признательна, потому что я застрял на этом в течение 3 дней.

Спасибо, Уилл

1 Ответ

1 голос
/ 03 июня 2011

Используете ли вы двоичный выпуск TCPPortMapper?Он не имеет исполняемого файла x86_64.

$ 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

Добавьте опцию GCC "-m32" или "-arch i386" в CFLAGS и LDFLAGS или создайте TCPPortMapper самостоятельно для арки x86_64.

...