gpt4 book ai didi

iphone - armv6和i386有什么区别?

转载 作者:行者123 更新时间:2023-12-03 19:46:03 24 4
gpt4 key购买 nike

我正在尝试将 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。

最佳答案

它们是完全不同的CPU架构。如果您尝试使用针对其中一个平台的预编译库,则无法在另一个平台上使用它,您需要找到针对您想要的平台的预编译库 - 适用于 iPhone 的 armv6,适用于 Mac 的 i386。

由于您标记了 iPhone,您可能拥有正确的库,但您的项目设置搞砸了 - 确保 Base SDK 设置正确(撰写本文时为 4.1)。一旦正确,它可能根本不会向您显示 i386 目标选项,并且一旦您选择 4.1 SDK,就会默认为“armv6 armv7”。

关于iphone - armv6和i386有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3791498/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com