I am trying to link libssh2.dylib (a third-party library compiled by Matthew Wilkinson using the libssh2 library from http://www.libssh2.org ) to my xcode project, but when I try the following code:
const char * libssh2_version(int required_version);
printf("libssh2 version: %s", libssh2_version(0));
Here is the error I get:
ld: warning: in /iaN 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
I get this error when I try to use any libssh2 API. Does anyone know what the problem is? These are the files that I linked to the project:
#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>
I also linked the libssh2.dylib file with the frameworks and added the recursive path to the “search header files” on the “Assembly” tab to the files libssh2.a, libgcrypt.a, libgpg-error.a.
source
share