gpt4 book ai didi

c - ANTLR C目标和XMLLib

转载 作者:行者123 更新时间:2023-12-02 04:07:40 24 4
gpt4 key购买 nike

我有一个用C编写的程序,该程序使用XMLLib和从ANTLR生成的词法分析器/解析器。

我的包含如下所示:

#include    "MyParser.h"
#include "MyLexer.h"
#include "antlr3.h"
#include <libxml/tree.h>
#include <libxml/parser.h>

问题是我的程序拒绝编译,并出现以下错误:
In file included from /usr/include/libxml2/libxml/parser.h:19:0,
from /usr/include/libxml2/libxml/globals.h:18,
from /usr/include/libxml2/libxml/threads.h:35,
from /usr/include/libxml2/libxml/xmlmemory.h:218,
from /usr/include/libxml2/libxml/tree.h:1248,
from MyProgram.c:4:
/usr/include/libxml2/libxml/valid.h:276:21: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/include/libxml2/libxml/valid.h:302:21: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
In file included from /usr/include/libxml2/libxml/globals.h:18:0,
from /usr/include/libxml2/libxml/threads.h:35,
from /usr/include/libxml2/libxml/xmlmemory.h:218,
from /usr/include/libxml2/libxml/tree.h:1248,
from MyProgram.c:4:
/usr/include/libxml2/libxml/parser.h:800:19: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
In file included from /usr/include/libxml2/libxml/parser.h:808:0,
from /usr/include/libxml2/libxml/globals.h:18,
from /usr/include/libxml2/libxml/threads.h:35,
from /usr/include/libxml2/libxml/xmlmemory.h:218,
from /usr/include/libxml2/libxml/tree.h:1248,
from MyProgram.c:4:
/usr/include/libxml2/libxml/xmlIO.h:293:19: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
In file included from /usr/include/libxml2/libxml/globals.h:18:0,
from /usr/include/libxml2/libxml/threads.h:35,
from /usr/include/libxml2/libxml/xmlmemory.h:218,
from /usr/include/libxml2/libxml/tree.h:1248,
from MyProgram.c:4:
/usr/include/libxml2/libxml/parser.h:961:22: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/include/libxml2/libxml/parser.h:967:22: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/include/libxml2/libxml/parser.h:1063:54: error: expected ‘)’ before ‘f’
/usr/include/libxml2/libxml/parser.h:1065:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xmlGetExternalEntityLoader’
/usr/include/libxml2/libxml/parser.h:1068:19: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant

如果我不包括前两个,则一切都将正确编译(我将main()函数替换为简单的“返回0”)。知道是什么原因造成的吗? :(

我的编译命令如下所示:
gcc *.c -c -lantlr3c -I/usr/include/libxml2

编辑:如果这有所作为,我从Ubuntu软件包管理器安装了libxml2-dev软件包

最佳答案

看起来有些宏观问题。 parser.h的961行包含ID,可以在您的 header 之一中定义ID。

关于c - ANTLR C目标和XMLLib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6769548/

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