其他分享
首页 > 其他分享> > 错误:没有包含要在其中搜索stdio.h的路径

错误:没有包含要在其中搜索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遮盖为包含路径?

解决方法:

问题是我的路径中还有另一个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"

标签:bash,gcc,c-3,linux
来源: https://codeday.me/bug/20191209/2095406.html