This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: compile problem


Chris:

I'm no expert, but I'll take a swag.

This is happening because the compiler doesn't know where to look for stdio.h, probably because it was installed in a "non-standard" location. For example, if it was installed to /usr/local/include/ instead of /usr/include/ (or wherever the compiler expects it), the compiler can't find it.

Long story short, you probably need to locate stdio.h and direct the compiler to find it using -I (That's the dash 'eye' option). So if stdio.h is in /usr/local/include/ I would compile with: gcc -I/ usr/local/include/ hello.c.

You can also find information on the internet about how to add a non- standard directory to the compiler's search path so you don't have to do this every time, but I'm lame on that and just use these options every time.


Blake Huff



"I'd like to take this opportunity to thank my cat for letting me live here."




On Feb 12, 2007, at 5:34 PM, Chris Bruno wrote:

Hello all,

I have just tried to compile a simple "Hello World" program in C, but it
failed to do so.
source code:
#include <stdio.h>


int main()
{
	printk("Hello World!\n");
	getchar();
	return 0;
}

error message:
------@--------------:~/Programs/C$ gcc hello.c
hello.c:1:20: error: stdio.h: No such file or directory
hello.c: In function ‘main’:
hello.c:5: warning: incompatible implicit declaration of built-in
function ‘printf’


I then changed 'printf' to 'printk' in the source code and got this error message only: ------@--------------:~/Programs/C$ gcc hello.c hello.c:1:20: error: stdio.h: No such file or directory


I'm using a fresh install of Ubuntu Edgy Eft (6.10), and it has gcc 4.1
installed.


-chris




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]