问题描述
我使用的是 Debian 8 (Jessie),64 位.我安装了 libxml2-dev
,它现在位于 /usr/include/libxml2/libxml
.
I am on Debian 8 (Jessie), 64 Bit. I installed libxml2-dev
, which now sits in /usr/include/libxml2/libxml
.
但是当我这样做时(就像 libxml
文档说的那样)
But when I do (just like libxml
docs say)
#include <libxml/parser.h>
我只在编译时得到(使用 gcc
)
I only get when compiling (with gcc
)
fatal error: libxml/parser.h: no such file or directory
注意:在另一台机器上,使用旧的 64 位 Suse,其中 libxml2-dev
位于完全相同的路径中,与新的 Debian 相比,没有设置其他环境变量,它工作得非常好.使用完全相同的 makefile 从一台计算机迁移到另一台计算机时出现问题.所有 我需要的其他 -dev
库在迁移后刚刚工作(使用他们记录的 #include <path>
)(它们都已安装使用 apt-get
),编译时仅找不到 libxml2-dev
.
Notes: On another machine, with an old 64 Bit Suse, where libxml2-dev
sits in the exact same path and no other environment vars are set compared to the new Debian, it works perfectly fine. Problem occured while migrating from one to another computer using the exact same makefiles. All other -dev
libs that I need just worked (with their documented #include <path>
) after the migration (they were all installed with apt-get
), only libxml2-dev
is not found on compilation.
我是否需要做任何其他事情才能使 libxml2-dev
可见?
Do I need to do anything else to make libxml2-dev
visible?
推荐答案
尝试在 parser.h
文件所在的位置显式包含编译,即像这样
Try to compile with explicite inclusion where the parser.h
file is, i.e. smth like this
g++ -I/usr/include/libxml2/
以下环境变量也可用于查找头文件
Following environment variables can also be used for lookup of header files
CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
OBJC_INCLUDE_PATH
找到更多信息这里
这篇关于编译器找不到 libxml/parser.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!