请教:
我想在LARBIN里调用 别的C语言的函数不知道怎么办
http://www.nacona.cn/PARSE.tar.gz 这是个c语言写的 HTML语法分析
在LARBIN里的 FIL.cc 有对HTML分析的部分,但不完善,我想在 LARBIN file.cc的 void html::parseHtml () 函数里调用 PARSE.tar.gz里面的 BitToken.c的 void Bit_BeginToken(BitTokenContext *global_cx) 函数
我在LARBIN FILE.cc 加入
#include "BitHtml.h"
#include "BitToken.h"
#include "BitStr.h"
#include "BitTokenList.h"
#include "BitTokenAttrList.h"
并且 声明一个变量BitTokenContext *global_cx;
但MAKE DEBUG 说
fetch/file.o: In function `html::parseHtml()':
/root/netbitlarbin/src/fetch/file.cc:539: undefined reference to `Bit_NewContext()'
我在网上查询 是因为 在C++里如果调用 C的函数需要告诉编译器
#ifdef __cplusplus
extern "C" {
#endif
在尾部添加:
#ifdef __cplusplus
}
#endif
但我在LARBIN 的 file.h 里加入这个说明 编译还是提示
fetch/file.o: In function `html::parseHtml()':
/root/netbitlarbin/src/fetch/file.cc:539: undefined reference to `Bit_NewContext()'
请帮忙 在你的LARBIN 里看看如何调用 Bit_BeginToken(BitTokenContext
这个函数对HTML解析做得比较好,你真的可以研究一下
|
Blog作者的回复: 需要在larbin.make里面添加一些东西。比如我加入Store类,需要做如下改动。 INTERF-OBJ:=input.o useroutput.o output.o Store.o ABS-INTERF-OBJ:=interf/input.o interf/useroutput.o interf/output.o \ interf/Store.o |