public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Blake Huff <stangmechanic@gmail.com>
To: Chris Bruno <fmaanimefreak@gmail.com>,  GCC-Help <gcc-help@gcc.gnu.org>
Subject: Re: compile problem
Date: Tue, 13 Feb 2007 00:03:00 -0000	[thread overview]
Message-ID: <470A289E-6B2A-4762-A1E7-5A213A6E4A9E@gmail.com> (raw)
In-Reply-To: <1171323268.9331.10.camel@crispy-desktop>

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
>
>

  reply	other threads:[~2007-02-12 23:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 23:53 Chris Bruno
2007-02-13  0:03 ` Blake Huff [this message]
2007-02-13  8:42 ` Grigory Zagorodnev
  -- strict thread matches above, loose matches on Subject: below --
2006-01-28 15:52 Compile problem CodeHeads
2006-01-28 16:49 ` Sven Eschenberg
2006-01-28 17:37   ` CodeHeads
2006-01-28 18:32     ` Sven Eschenberg
     [not found] <39dc493204092210301676ed7e@mail.gmail.com>
2004-09-22 17:40 ` Compile Problem Adam McCarthy
2000-12-10 19:23 compile problem Thiemo Nagel
2000-12-11  7:37 ` Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=470A289E-6B2A-4762-A1E7-5A213A6E4A9E@gmail.com \
    --to=stangmechanic@gmail.com \
    --cc=fmaanimefreak@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).