链接犰狳与Xcode

Dan*_*son 3 xcode linker armadillo

我有一个庞大的现有Xcode项目,现在我想添加armadillo库.

http://arma.sourceforge.net/

我已经下载了它(使用macports)并使用Cmake(就像C++终端应用程序一样).我没有在我的大项目(iPad应用程序)中使用Cmake,所以我试图链接库.我查看了我使用cmake的xcode-project文件,并将其添加到我的项目中.

补充:标题搜索路径:/ opt/local/include库搜索路径:/ opt/local/lib其他链接器标志:-larmadillo

我还将libarmadillo.3.4.0.dylib添加到"使用二进制文件链接库"

    ld: warning: ld: warning: ignoring file /opt/local/lib/libarmadillo.3.4.0.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7s): /opt/local/lib/libarmadillo.3.4.0.dylibld: warning: ignoring file /opt/local/lib/libarmadillo.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7s): /opt/local/lib/libarmadillo.dylib
    ignoring file /opt/local/lib/libz.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7s): /opt/local/lib/libz.dylib

    Undefined symbols for architecture armv7s:
      "_deflateInit_", referenced from:
  _compress_data in libTestFlight.a(tf_compression.o)
      "_deflateEnd", referenced from:
  _compress_data in libTestFlight.a(tf_compression.o)
      "_deflate", referenced from:
  _compress_data in libTestFlight.a(tf_compression.o)
    ld: symbol(s) not found for architecture armv7s
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我有什么想法可以解决这个问题?

小智 13

尝试将libz.lib添加到您的构建目标:

将libz添加到Link Binary With Libraries Build Phase

  1. 在Project Navigator中选择您的项目
  2. 选择要为其启用SDK的目标
  3. 选择Build Phases选项卡
  4. 使用Libraries Phase打开Link Binary
  5. 单击+以添加新库
  6. 在列表中找到libz.dylib并添加它
  7. 重复步骤2 - 6,直到您要使用SDK的所有目标都具有libz.dylib

资料来源:https://testflightapp.com/sdk/doc/1.1/