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

标签 c++ g++ makefile

所以基本上我有一些非常简单的代码,其中包括 <BigIntegerLibrary.hh>位于 /Users/wen/Projects/include/bigint .我正在用这个编译:

g++ main.cpp -o Main -I/Users/wen/Projects/include/bigint

但它报告了一个 fatal error ,它找不到该文件。我做对了吗?谢谢!

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

最佳答案

尝试

#include "BigIntegerLibrary.hh"

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

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

关于c++ - g++即使指定了标题也找不到标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13938298/

相关文章:

makefile - GNU make 中的递归通配符?

c++ - VC++ 2012 中出乎意料的模棱两可的重载解析

c++ - 如何解压缩多维 c 样式数组类型并声明 std::array 实例?

c++ - 在 C++ 中使用 vector 与列表的图形表示

c++ - 柔性 : use of yymore()

c++ - g++ - 无法链接到使用 VS2012 构建的静态库

c++ - 模板的复制构造函数

c - undefined reference 而不是 makefile

c++ - 如果返回类具有析构函数,则忽略 gnu::warn_unused_result 属性

c - Msys 在 Powershell 中生成 - 没有这样的文件或目录