【问题标题】:I run the libimobiledevice getting started code, got err?我运行 libimobiledevice 入门代码,出错了吗?
【发布时间】:2021-02-06 05:56:34
【问题描述】:

我使用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,但仍然无法编译。

【问题讨论】:

    标签: c libimobiledevice


    【解决方案1】:

    您需要包含libimobiledevice 库,试试这个:

    gcc hello.c -o hello -limobiledevice-1.0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-06
      • 2014-04-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多