错误:没有可在其中搜索 stdio.h 的包含路径
我以前能够编译 C 程序,但现在不能:
$ cat helloworld.c
#include <stdio.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}
$ gcc helloworld.c
helloworld.c:1:19: error: no include path in which to search for stdio.h
是的,我有 /usr/include/stdio.h
。是的,build-essentials
已安装。
在我修改 ~/.bashrc
以运行用户目录中安装的程序后,此问题开始出现。我知道这是错误的,因为如果我删除 ~/.bashrc
,它就会起作用。
什么环境变量会将 /usr/include
隐藏为包含路径?
I used to be able to compile C programs, but now I can't:
$ cat helloworld.c
#include <stdio.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}
$ gcc helloworld.c
helloworld.c:1:19: error: no include path in which to search for stdio.h
Yes, I do have /usr/include/stdio.h
. Yes, build-essentials
is installed.
This problem began after I modified my ~/.bashrc
to run a program installed in my user directory. I know this is what's wrong because if I remove ~/.bashrc
, it works.
What environment variable would be shadowing /usr/include
as an include path?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是我的 PATH 中有另一个 GCC:
当我尝试编译“Hello World”时,它正在运行 68000 的编译器,而不是我的系统编译器:D
我在我的
~/.bashrc 中有这个
:由于路径是按顺序扫描的,因此首先会看到
/home/joey/gcc4ti/bin
中的gcc
。我把它改为:The problem was that I had another GCC in my PATH:
When I was trying to compile "Hello World", it was running a compiler for a 68000, not my system compiler :D
I had this in my
~/.bashrc
:Because paths are scanned in order, the
gcc
in/home/joey/gcc4ti/bin
is seen first. I changed it to: