我正在尝试将 libssh2.dylib(由 Matthew Wilkinson 使用来自http://www.libssh2.org的 libssh2 库编译的第 3 方库)链接到我的 xcode 项目,但是当我尝试以下代码时:
const char * libssh2_version(int required_version);
printf("libssh2 version: %s", libssh2_version(0));
这是我得到的错误:
ld: warning: in /iaN's Work/Developer/Apple/iPhone/apps/PortScanner/libssh2.1.dylib, file was built for armv6 which is not the architecture being linked (i386)
Undefined symbols:
"_libssh2_version", referenced from:
-[Request connect] in Request.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
当我尝试任何 libssh2 API 时出现此错误。任何人有任何线索的问题是什么?这些是我链接到项目的文件:
// SSH Librarys
#include "libssh2_config.h"
#include "libssh2.h"
#include "libssh2_sftp.h"
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
# ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
我还将 libssh2.dylib 文件链接到框架,并将构建选项卡上的“搜索头文件”的递归路径添加到文件 libssh2.a、libgcrypt.a、libgpg-error.a。