我正在学习使用make。我正试图在我的家庭机器上使用g++编译一个程序,我已经成功地在学校机器上使用xl编译了这个程序。我正试图链接到我构建的外部库,并将其放在一个单独的目录中。我试图包含头文件,但是g++声称包含目录不存在。包含目录肯定存在,选项卡完整地填充它,find
也定位它。
为什么g++决定目录不存在?通常,是什么原因导致目录被忽略?我想知道为什么这是坏的,这样我才能更好地写makefiles。对我来说,更重要的是,如何修复这个问题,让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++“忽略了不存在的目录”。
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
发布于 2015-04-22 03:23:06
似乎您有一个区分大小写的文件系统。有些地方有GitHub
,有些地方有Github
。让它们都正确匹配,你的状态就会更好。
https://stackoverflow.com/questions/29787080
复制相似问题