gpt4 book ai didi

c++ - LZO的问题

转载 作者:行者123 更新时间:2023-11-28 08:25:25 27 4
gpt4 key购买 nike

所以我想在我的应用程序中使用 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'

指向:

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;
}

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

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

我做错了什么?

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

最佳答案

标题是不够的,你需要链接到图书馆。你读过文档了吗?

关于c++ - LZO的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4235548/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com