未检测到gcc的包含路径中的头文件

时间:2018-08-31 03:32:35

标签: c linux gcc ld include-path

我已将库(libxc)安装到本地目录(./configure --prefix=$HOME/materials/mat)中。我适当地更改了环境变量,但是在编译包含libxc的测试代码时遇到以下错误:

(mat) amir@bose test]$ gcc test_libxc.cc
test_libxc.cc:3:10: fatal error: xc.h: No such file or directory
 #include <xc.h>
          ^~~~~~
compilation terminated.

但是xc.h位于/home/amir/materials/mat/include目录中:

(mat) [amir@bose test]$ ls /home/amir/materials/mat/include/
libxc_funcs_m.mod   python3.6m/         xc_f03_lib_m.mod    xc_f90_lib_m.mod    xc_f90_types_m.mod  xc_funcs.h          xc_funcs_removed.h  xc.h                xc_version.h

在gcc的搜索目录列表中(下面的第五行):

(mat) [amir@bose test]$ echo | gcc -E -Wp,-v -
ignoring nonexistent directory "/opt/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/amir/materials/mat/include
 .
 /opt/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include
 /usr/local/include
 /opt/gcc/7.3.0/include
 /opt/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include-fixed
 /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"

我无法理解这种行为。如果您有任何疑问,请与我们分享。

0 个答案:

没有答案