C 错误:没有要在其中搜索stdio.h的包含路径
我以前能够编译C程序,但现在我不能:C 错误:没有要在其中搜索stdio.h的包含路径,c,linux,gcc,bash,C,Linux,Gcc,Bash,我以前能够编译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 $cat helloworld.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
$cat helloworld.c
#包括
内部主(空)
{
printf(“你好,世界!\n”);
返回0;
}
$gcc helloworld.c
helloworld.c:1:19:错误:没有要在其中搜索stdio.h的包含路径
是的,我有/usr/include/stdio.h
。是,安装了build-essentials
这个问题是在我修改了~/.bashrc
以运行安装在我的用户目录中的程序之后开始的。我知道这是错误的,因为如果我删除~/.bashrc
,它就会工作
什么环境变量会将
/usr/include
隐藏为包含路径?问题是我的路径中有另一个GCC:
$ which gcc
/home/joey/gcc4ti/bin/gcc
当我试图编译“Hello World”时,它运行的是68000的编译器,而不是我的系统编译器:D
我的~/.bashrc
中有这个:
export PATH="/home/joey/gcc4ti/bin:$PATH"
由于路径是按顺序扫描的,因此首先会看到/home/joey/gcc4ti/bin
中的gcc
。我把它改成:
export PATH="$PATH:/home/joey/gcc4ti/bin"
粘贴
.bashrc
的内容会很有帮助。