因此,我尝试在我的应用程序中使用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编译我的应用程序。
发布于 2010-11-21 07:20:02
头文件是不够的,你需要链接到库。你读过文档了吗?
https://stackoverflow.com/questions/4235548
复制相似问题