g ++即使在指定时也找不到标题 [英] g++ can't find headers even when it's specified

查看:103
本文介绍了g ++即使在指定时也找不到标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以基本上我有一些非常简单的代码,它包含 / Users / wen / Projects / include /中的< BigIntegerLibrary.hh> BIGINT 。我正在编译:

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



但它报告了一个致命错误,它无法找到该文件。我做对了吗?
$ b

main.cpp:4:10:致命错误:'BigIntegerLibrary.hh'文件未找到

解决方案

尝试

 #包含BigIntegerLibrary.hh

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



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


So basically I have some really simple code that includes <BigIntegerLibrary.hh> which resides in /Users/wen/Projects/include/bigint. I was compiling with this:

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

but it reported a fatal error that it could not find the file. Am I doing it right? Thanks!

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

解决方案

Try

#include "BigIntegerLibrary.hh"

If you specify the #included file with angle brackets (#include <includeFile.h>) the compiler will try to find it in a predefined location whereas if you use #include "includeFile" the compiler first tries the paths you specified with the -I compiler option.

The -I compiler option cannot be used to specify where the <...> files are.

这篇关于g ++即使在指定时也找不到标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆