C++ Ubuntu Eclipse libxml2 错误:致命错误:libxml/xmlversion.h:没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23254475/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 00:22:45  来源:igfitidea点击:

Ubuntu Eclipse libxml2 error : fatal error: libxml/xmlversion.h: No such file or directory

c++eclipselibxml2

提问by andressophia

I want to use libxml2 in my eclipse project. I can use this library on command line by "

我想在我的 eclipse 项目中使用 libxml2。我可以通过“在命令行上使用这个库

g++ main.cpp -I/usr/include/libxml2 -lxml2 -o output "

g++ main.cpp -I/usr/include/libxml2 -lxml2 -o 输出"

But I can't use on eclipse.I add C++ Build->Setting->GCC C Compiler->Includes

但是我不能在eclipse上使用。我添加C++ Build->Setting->GCC C Compiler->Includes

-I/usr/include/libxml2 and I add C++ Build->Setting->GCC C++ Linker->library -lxml2

-I/usr/include/libxml2 并添加 C++ Build->Setting->GCC C++ Linker->library -lxml2

But When I build my project, I get an error via

但是当我构建我的项目时,我收到一个错误

libxml/parser.h:15:31: fatal error: libxml/xmlversion.h: No such file or directory

libxml/parser.h:15:31: 致命错误: libxml/xmlversion.h: 没有那个文件或目录

回答by Charles Xu

This is because libs are not complete. You should install them.

这是因为库不完整。你应该安装它们。

Here's one thread that might be helpful.

这是一个可能有用的线程。

One solution:

一种解决方案:

sudo apt-get install libxml2-dev libxslt1-dev

For Redhat/Centos/Fedora:

对于 Redhat/Centos/Fedora:

yum install libxml-devel