我运行libimobiledevice入门代码,看到错误了吗?

问题描述

我使用gcc来编译代码

#include <stdio.h>
#include <stdlib.h>
#include <libimobiledevice/lockdown.h>
#include <libimobiledevice/libimobiledevice.h>
#include <plist/plist.h>

int main()
{
    static char *udid = NULL;

    /* Device Handle */
    idevice_t device = NULL;

    /* Try to connect to first USB device */
    if (idevice_new_with_options(&device,NULL,IDEVICE_LOOKUP_USBMUX) != IDEVICE_E_SUCCESS) {
        printf("ERROR: No device found!\n");
        return -1;
    }

    /* Retrieve the udid of the connected device */
    if (idevice_get_udid(device,&udid) != IDEVICE_E_SUCCESS) {
    printf("ERROR: Unable to get the device UDID.\n");
    idevice_free(device);
    return -1;
    }

    /* Outputs device identifier */
    printf("Connected with UDID: %s\n",udid);

    /* Cleanup */
    idevice_free(device);
    free(udid);
}

得到

x86_64体系结构的未定义符号: “ _idevice_free”,引用自: _main在1-af7b2e.o中 “ _idevice_get_udid”,引用自: _main在1-af7b2e.o中 “ _idevice_new_with_options”,引用自: _main在1-af7b2e.o中 ld:找不到架构x86_64的符号

虽然我尝试过gcc -lstdc++ hello.c -o hello,但仍无法编译。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)