代码之家  ›  专栏  ›  技术社区  ›  Richard Knop

LZO的问题

  •  0
  • Richard Knop  · 技术社区  · 15 年前

    所以我正在尝试在我的应用程序中使用LZO。以下是我将其包括在内的方法:

    #include "lzoconf.h"
    #include "lzodefs.h"
    #include "lzo1x.h"
    /* portability layer */
    static const char *progname = NULL;
    #define WANT_LZO_MALLOC 1
    #define WANT_XMALLOC 1
    #include "portab.h"
    

    然后在应用程序中我会:

    if (lzo_init() != LZO_E_OK)
    {
        printf("internal error - lzo_init() failed !!!\n");
        printf("(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable '-DLZO_DEBUG' for diagnostics)\n");
        return 4;
    }
    

    它编译得很好。编译期间没有错误或警告。

    但是,当我尝试运行应用程序时,有两个错误:

    /home/richard/client/src/portab.h:145: undefined reference to `__lzo_align_gap'
    

    在portab.h的这一行中的哪个点:

    if (__lzo_align_gap(p, (lzo_uint) sizeof(lzo_align_t)) != 0)
    {
        printf("%s: C library problem: malloc() returned mis-aligned pointer!\n", progname);
        exit(1);
    }
    return p;
    

    在我的申请中:

    /home/richard/client/src/main.cc:108: undefined reference to `__lzo_init_v2'
    

    指的是:

    如果(lzo_init()!= LZOZYEOK OK)
    {
    printf(“内部错误-lzo_init()失败!!!!\n);
    printf(“(这通常表示编译器错误-尝试在不进行优化的情况下重新编译,并启用“-dlzo-debug”进行诊断”);
    返回4;
    }
    

    我的源目录中有所有头文件:

    config.h
    lzo1x.h
    lzoconf.h
    lzodefs.h
    miniacc.h
    portab.h
    portab_a.h
    

    我做错什么了?

    我正在Anjuta IDE的Ubuntu 10.10中编译我的应用程序。

    1 回复  |  直到 15 年前
        1
  •  1
  •   fredoverflow    15 年前

    标题不够,需要链接到库。你看过文件了吗?