search

Home  >  Q&A  >  body text

objective-c 调用第三方c语言库

我想从object-c程序中,调用svn的api,实现版本控制的功能。
我先在mac上费了好大力气,成功编译了subversion的源码。然后在xcode的build-settings里面的header path中加入了svn api的头文件路径。又在build-phases中将libsvn_client_1.a引入到了libraries里面。但编译的时候报错,代码如下:

头部引入

#import "svn_client.h"
- (void)tableViewSelectionDidChange:(NSNotification *)notification
{
    NSLog(@"select one row!");
    char* url = "http://***.***.com/svn/***/unity/****";
    //list_repo2(url);
    //listRepo(url);
    // 测试下
    svn_checksum_size(nil);
}

报错的信息如下 :

Undefined symbols for architecture x86_64:
  "_svn_checksum_size", referenced from:
      -[ViewController tableViewSelectionDidChange:] in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

拜托大家帮忙看看~~

PHP中文网PHP中文网2802 days ago492

reply all(2)I'll reply

  • 阿神

    阿神2017-04-24 09:15:32

    The problem has been solved, please see my comment on @isteven

    reply
    0
  • PHP中文网

    PHP中文网2017-04-24 09:15:32

    Your static library does not support compilationx86_64对应的二进制。如果自己编译的话,需要增加对x86_64. It doesn’t matter if it doesn’t support it. It just won’t run on the simulator and can only be run on a real machine.
    In addition, when running on a real machine, an error will be reported if it is not supported amr64.
    Set the compilation options, which are required if all CPUs are supported so far (the last two are used to support the simulator): armv7 armv7s arm64 x86 x86_64.

    reply
    0
  • Cancelreply