是什么导致 g++ 忽略不存在的目录
What causes g++ ignoring nonexisting directory
我正在学习使用 make。我正在尝试在我的家用机器上使用 g++ 编译一个程序,我已经在学校机器上使用 xl 成功编译了该程序。我正在尝试 link 使用我构建并放置在单独目录中的外部库。我试图包含头文件,但 g++ 声称包含目录不存在。 include 目录确实存在,tab complete 填写它并且 find
也找到它。
为什么g++判断目录不存在?通常是什么导致目录被忽略?我想知道为什么这会中断,以便我可以更好地编写 makefile。对我来说更重要的是,我该如何解决这个问题并让 g++ 在我告诉它查找的任何目录中搜索任意头文件?
我看到了关于 g++ 忽略目录的问题,但那些是在忽略各种系统默认位置的情况下。他们通常通过删除冲突版本或重新安装他们的工具来解决问题。我的问题不同,因为 g++ 忽略了实际存在的用户定义目录。
src/a3.cc:1:17: fatal error: apf.h: No such file or directory
#include "apf.h"
$ find /home/USER/Documents/GitHub/core/apf/
/home/USER/Documents/GitHub/core/apf/
/home/USER/Documents/GitHub/core/apf/apfUserData.cc
....
/home/USER/Documents/GitHub/core/apf/apf.h
....
我尝试使用 -I
在 make 文件中手动指定目录
apf = /home/USER/Documents/Github/core/apf/
CFLAGS = $(CFLAGS) -Wall -g -I $(apf) --pedantic-errors --verbose
我也试过设置CPLUS_INCLUDE_PATH
export CPLUS_INCLUDE_PATH = $(apf)
对于这些尝试中的每一个,我都看到相同的错误,即 g++ 是 "ignoring nonexistant directory"
COLLECT_GCC=/usr/bin/g++
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/home/USER/Documents/Github/core/apf/"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory "/usr/local/include"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
./inc
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/backward
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include
/usr/local/include
/usr/include
End of search list.
GNU C++ (GCC) version 4.9.2 20150212 (Red Hat 4.9.2-6) (x86_64-redhat-linux)
compiled by GNU C version 4.9.2 20150212 (Red Hat 4.9.2-6), GMP version 6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 954ba53e83b294b646fa1b6b73a69682
您的文件系统似乎区分大小写。您在某些地方有 GitHub
,在其他地方有 Github
。让它们都正确匹配,你的身材会更好。
我正在学习使用 make。我正在尝试在我的家用机器上使用 g++ 编译一个程序,我已经在学校机器上使用 xl 成功编译了该程序。我正在尝试 link 使用我构建并放置在单独目录中的外部库。我试图包含头文件,但 g++ 声称包含目录不存在。 include 目录确实存在,tab complete 填写它并且 find
也找到它。
为什么g++判断目录不存在?通常是什么导致目录被忽略?我想知道为什么这会中断,以便我可以更好地编写 makefile。对我来说更重要的是,我该如何解决这个问题并让 g++ 在我告诉它查找的任何目录中搜索任意头文件?
我看到了关于 g++ 忽略目录的问题,但那些是在忽略各种系统默认位置的情况下。他们通常通过删除冲突版本或重新安装他们的工具来解决问题。我的问题不同,因为 g++ 忽略了实际存在的用户定义目录。
src/a3.cc:1:17: fatal error: apf.h: No such file or directory
#include "apf.h"
$ find /home/USER/Documents/GitHub/core/apf/
/home/USER/Documents/GitHub/core/apf/
/home/USER/Documents/GitHub/core/apf/apfUserData.cc
....
/home/USER/Documents/GitHub/core/apf/apf.h
....
我尝试使用 -I
apf = /home/USER/Documents/Github/core/apf/
CFLAGS = $(CFLAGS) -Wall -g -I $(apf) --pedantic-errors --verbose
我也试过设置CPLUS_INCLUDE_PATH
export CPLUS_INCLUDE_PATH = $(apf)
对于这些尝试中的每一个,我都看到相同的错误,即 g++ 是 "ignoring nonexistant directory"
COLLECT_GCC=/usr/bin/g++
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/home/USER/Documents/Github/core/apf/"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory "/usr/local/include"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
./inc
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/backward
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include
/usr/local/include
/usr/include
End of search list.
GNU C++ (GCC) version 4.9.2 20150212 (Red Hat 4.9.2-6) (x86_64-redhat-linux)
compiled by GNU C version 4.9.2 20150212 (Red Hat 4.9.2-6), GMP version 6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 954ba53e83b294b646fa1b6b73a69682
您的文件系统似乎区分大小写。您在某些地方有 GitHub
,在其他地方有 Github
。让它们都正确匹配,你的身材会更好。