即使指定了标题,g ++也找不到标题

时间:2012-12-18 17:24:41

标签: c++ g++ makefile

所以基本上我有一些非常简单的代码,其中包含<BigIntegerLibrary.hh>/Users/wen/Projects/include/bigint位于g++ main.cpp -o Main -I/Users/wen/Projects/include/bigint。我正在编译:

main.cpp:4:10: fatal error: 'BigIntegerLibrary.hh' file not found

但它报告了一个无法找到该文件的致命错误。我做得对吗?谢谢!

{{1}}

2 个答案:

答案 0 :(得分:5)

尝试

#include "BigIntegerLibrary.hh"

如果使用尖括号(#include <includeFile.h>)指定 #included 文件,编译器将尝试在预定义位置找到它,而如果首先使用#include "includeFile"编译器尝试使用-I编译器选项指定的路径。

-I编译器选项不能用于指定<...>文件的位置。

答案 1 :(得分:0)

如果路径正确,g++应该会看到文件。

如果在include指令中使用绝对路径,则应更改引号:

#include "/Users/wen/Projects/include/bigint/BigIntegerLibrary.hh"
相关问题