C程序中包含的头文件的默认路径是什么?
看看我是否在任何 c 文件中写入
#include "header.h"
,那么它会在当前目录中搜索该文件
,但是当我写入
#include <header.h>
时它将去哪里找到该文件? C程序中包含的头文件的默认路径是什么?
看到我已经在 /usr/local 中安装了 gstreamer,但是当我包含时,
#include <gst/gst.h>
我收到 致命错误:gst/gst.h:没有这样的文件或目录
如何删除此错误?
see if i write in any c file like
#include "header.h"
then it will search this file in current directory
but when i write
#include <header.h>
then where it will go to find this file ?
what is defualt path for header file included in c program?
see i have installed gstreamer in /usr/local but when i am including
#include <gst/gst.h>
i am geeting fatal error: gst/gst.h: No such file or directory
How can i remove this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试运行
gcc -v -E -
。当我这样做时,部分输出如下:这不是 gstreamer 问题的答案,但我希望这仍然有帮助!
摘自此处
Try running
gcc -v -E -
. When I do, part of the output is as follows:It's not an answer to the gstreamer question, but I hope this still helps!
Pulled from here
默认路径是
如果您使用其他路径,您可以在编译命令中添加
-I
标志。在您的情况下,假设您有一个/usr/local/gst/include
目录,您可以添加-I/usr/local/gst/include
并使用#include
The default paths are
If you use another path, you can add in your compile command with
-I
flag. In your case, assuming you have a/usr/local/gst/include
directory, you may add-I/usr/local/gst/include
and use#include <whatever_you_need.h>
搜索的路径取决于实现(和当前配置)。查找包含路径的正确方法是使用
pkg-config
The path searched depends on the implementation (and current configuration). The correct way to find the include path is to use
pkg-config
<>
内容的默认路径是/usr/include
,至少在 Unix 上是这样。您可以使用
-I /my/new/path
编译器选项添加任意数量的默认路径。The default path for
<>
stuff is/usr/include
, at least on Unix.You can add as many default paths as you want with
-I /my/new/path
compiler option.然后按 CTRL+C
and then CTRL+C
您可以在以下位置找到这些文件:
you can find those files in: