开发者

Cannot compile when using libxml

I have a source file that I can run via the terminal using

gcc source.c -I/usr/include/libxml2 -lxml2 -o output

but when I #include the source file which includes the libxml source files, the compiler complains that the libxml/开发者_开发问答xmlmemory.h: , libxml/parser.h:, libxml/xpath.h cannot be found : no such file or directory.


You need always to keep the -I/usr/include/libxml2 in your gcc statement, so that it can find the header files.


You can also use xml2-config --cflags --libs to retrieve the compilation flags to add.

kjp@vbox:~/Dev/ScratchDir$ xml2-config --cflags --libs
-I/usr/include/libxml2
-lxml2
kjp@vbox:~/Dev/ScratchDir$


It seems like the source is referencing libxml, not libxml2 Can you verify that

/usr/include/libxml2/libxml/xmlmemory.h

is in fact accessible? (try to view it)

You don't compile the headers, the headers just have to be accessible as 'description' of the what the libraries implement

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜