我已经下载了ximpleware_2.11_c.zip(C版本的vtd-xml),当我 我试图在linux下编译它我有以下错误信息:
In file included from vtdNav.c:19:
vtdNav.h:82: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h:506: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h: In function ‘writeIndex_VTDNav’:
vtdNav.c: At top level:
vtdNav.c:3410: error: conflicting types for ‘writeIndex_VTDNav’
vtdNav.h:347: error: previous declaration of ‘writeIndex_VTDNav’ was here
vtdNav.c: In function ‘dumpXML’:
vtdNav.c:3554: error: too many arguments to function ‘dumpXML2’
vtdNav.c: At top level:
vtdNav.c:3562: error: conflicting types for ‘dumpXML2’
vtdNav.h:362: error: previous declaration of ‘dumpXML2’ was here
In file included from vtdNav.c:19:
vtdNav.h:82: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h:506: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h: In function ‘writeIndex_VTDNav’:
vtdNav.h:507: error: ‘f’ undeclared (first use in this function)
vtdNav.h:507: error: (Each undeclared identifier is reported only once
vtdNav.h:507: error: for each function it appears in.)
vtdNav.h:507: error: too many arguments to function
‘vn->__writeIndex_VTDNav’
vtdNav.h: At top level:
vtdNav.h:675: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h:695: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.c: In function ‘_writeIndex2_VTDNav’:
vtdNav.c:3751: error: too many arguments to function ‘writeIndex_VTDNav’
vtdNav.c: In function ‘dumpXML’:
vtdNav.c:3874: error: too many arguments to function ‘dumpXML2’
vtdNav.c: At top level:
vtdNav.c:3882: error: conflicting types for ‘dumpXML2’
vtdNav.h:695: error: previous declaration of ‘dumpXML2’ was here
make: *** [vtdNav.o] Error 1
如何在linux下构建它?
感谢您的回复。
答案 0 :(得分:1)
我已经把
了#include <stdio.h>
in:
vtdNav.h和transcoder.h
现在编译。
答案 1 :(得分:1)
我很遗憾地发帖询问如何编译示例。我已经通过修改ximpleware_2.11_c中已经存在的makefile来编译它们,这样就可以了:
CC=gcc
CFLAGS= -c -O3 -Wall -Winline -fgnu89-inline -fomit-frame-pointer-fforce-addr -frerun-cse-after-loop -fexpensive-optimizations -fregmove -frerun-loop-opt -fmerge-all-constants -fno-branch-count-reg -funroll-loops -fpeephole -march=core2-falign-functions -falign-loops -falign-jumps -freorder-blocks -freorder-functions-fprefetch-loop-arrays -funswitch-loops -fbranch-target-load-optimize2 -fvpt --paraminline-unit-growth=300 --param max-inline-recursive-depth=2 --param large-function-growth=600
CFLAGS2 = -c -ggdb
LDFLAGS = -O3 -fomit-frame-pointer -fforce-addr -frerun-cse-after-loop-fexpensive-optimizations -fregmove -frerun-loop-opt -march=core2 -lm
LDFLAGS2 = -ggdb
all : hello_world
hello_world: hello_world.o ../../arrayList.o ../../fastIntBuffer.o ../../fastLongBuffer.o ../../contextBuffer.o ../../vtdNav.o ../../vtdGen.o ../../autoPilot.o ../../XMLChar.o ../../helper.o ../../lex.yy.o ../../l8.tab.o ../../literalExpr.o ../../numberExpr.o ../../pathExpr.o ../../filterExpr.o ../../binaryExpr.o ../../unaryExpr.o ../../funcExpr.o ../../locationPathExpr.o ../../intHash.o ../../unionExpr.o ../../decoder.o ../../XMLModifier.o ../../nodeRecorder.o ../../indexHandler.o ../../bookMark.o ../../elementFragmentNs.o ../../transcoder.o ../../textIter.o ../../variableExpr.o ../../cachedExpr.o
clean:
-rm *.o
hello_world.o : hello_world.c
${CC} ${CFLAGS} hello_world.c