错误:隐式声明函数'g_slist_free_full'

时间:2013-03-29 19:14:23

标签: c compilation compiler-errors implicit-declaration

我正在尝试编译一些名为libfprint的软件。我已经在另一台机器上成功编译了它,但是现在,在许多文件中,我收到以下错误:

tomselleck@ubuntuselleck:~/Documents/FingerBellProject/libfprint-0.5.0$ sudo make
[sudo] password for tomselleck: 
make  all-recursive
make[1]: Entering directory `/home/tomselleck/Documents/FingerBellProject/libfprint-0.5.0'
Making all in libfprint
make[2]: Entering directory `/home/tomselleck/Documents/FingerBellProject/libfprint-0.5.0/libfprint'
  CC       libfprint_la-aes1610.lo
drivers/aes1610.c: In function 'capture_read_strip_cb':
drivers/aes1610.c:619: error: implicit declaration of function 'g_slist_free_full'
make[2]: *** [libfprint_la-aes1610.lo] Error 1
make[2]: Leaving directory `/home/tomselleck/Documents/FingerBellProject/libfprint-0.5.0/libfprint'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/tomselleck/Documents/FingerBellProject/libfprint-0.5.0'
make: *** [all] Error 2

有什么想法吗?谢谢!

修改

我将发布一个错误行的示例:

    /* stop capturing if MAX_FRAMES is reached */
    if (aesdev->blanks_count > 10 || g_slist_length(aesdev->strips) >= MAX_FRAMES) {
        struct fp_img *img;

        fp_dbg("sending stop capture.... blanks=%d  frames=%d", aesdev->blanks_count, g_slist_length(aesdev->strips));
        /* send stop capture bits */
        aes_write_regv(dev, capture_stop, G_N_ELEMENTS(capture_stop), stub_capture_stop_cb, NULL);
        aesdev->strips = g_slist_reverse(aesdev->strips);
        img = aes_assemble(aesdev->strips, aesdev->strips_len,
            FRAME_WIDTH, FRAME_HEIGHT);

        g_slist_free_full(aesdev->strips, g_free);<---- Error here

        aesdev->strips = NULL;
        aesdev->strips_len = 0;
        aesdev->blanks_count = 0;
        fpi_imgdev_image_captured(dev, img);
        fpi_imgdev_report_finger_status(dev, FALSE);
        /* marking machine complete will re-trigger finger detection loop */
        fpi_ssm_mark_completed(ssm);
        /* Acquisition finished: restore default gain values */
        restore_gain();
    } else {
        /* obtain next strip */
        fpi_ssm_jump_to_state(ssm, CAPTURE_REQUEST_STRIP);
    }

out:
    g_free(data);
    libusb_free_transfer(transfer);
}

2 个答案:

答案 0 :(得分:3)

时会发生这种情况
  • 该函数的第一次使用先于其定义,
  • 该功能没有原型,或
  • 缺少必需的头文件。

确保文本或标题中有原型,或者在首次使用之前将函数移动到文件的前面。

答案 1 :(得分:0)

...也(括号内)不以root身份运行make,使用sudo。这部分是因为人们可以想象在构建过程中会破坏某些重要的东西(这不是root会阻止的东西),还有一般原则,即尽可能少地生根。

如果您确实在/usr/local等系统位置安装了某些内容,请自行构建,然后执行make -n install并检查将要安装的位置(假设您要构建的内容具有安装目标)。如果一切正常,只有sudo make install

相关问题