Joey Adams
Joey Adams

Reputation: 43380

error: no include path in which to search for stdio.h

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?

Upvotes: 3

Views: 21989

Answers (1)

Joey Adams
Joey Adams

Reputation: 43380

The problem was that I had another GCC in my PATH:

$ which gcc
/home/joey/gcc4ti/bin/gcc

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:

export PATH="/home/joey/gcc4ti/bin:$PATH"

Because paths are scanned in order, the gcc in /home/joey/gcc4ti/bin is seen first. I changed it to:

export PATH="$PATH:/home/joey/gcc4ti/bin"

Upvotes: 3

Related Questions