error: no include path in which to search for stdio.h
I used to be开发者_JAVA技巧 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?
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"
精彩评论