gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:46:52 26 4
gpt4 key购买 nike

所以基本上我有一些非常简单的代码,其中包括 <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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com