New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

gcc compiler, no stdio.h found


Post Reply New Thread Subscribe

 
Thread Tools
lzco
Guest
 
Posts: n/a

hi,
I want to compile C programs using the terminal (Darwin). I have an ibook with os x 10.4.2 .
I installed the Xcode Tools development package, along with gcc4.0 and gcc3.3 packages that come with Tiger under the Applications/Installers folder.

When I try to compile a simple hello world program, this is what i get:


Quote:
ibook:~/Documents era$ ls
assign1 hello.c
ibook:~/Documents era$ cat hello.c
#include <stdio.>

main() {
printf("Hello World!\n");
}

ibook:~/Documents era$ gcc -c hello.c
hello.c:1:18: error: stdio.: No such file or directory
hello.c: In function 'main':
hello.c:4: warning: incompatible implicit declaration of built-in function 'printf'
ibook:~/Documents era$ cd /usr/include
ibook:/usr/include era$ ls
gcc stdint.h
ibook:/usr/include era$ ls
gcc stdint.h
ibook:/usr/include era$ cd gcc
ibook:/usr/include/gcc era$ ls
darwin
ibook:/usr/include/gcc era$ cd darwin
ibook:/usr/include/gcc/darwin ra$ ls
3.3 3.3-fast 4.0 default
ibook:/usr/include/gcc/darwin era$ cd 4.0
ibook:/usr/include/gcc/darwin/4.0 era$ ls
c++ ppc_intrinsics.h
machine stdint.h
I would like to know how to properly installed gcc so that I can compile from the terminal, since I like writing my c programs using a simple text editor.

I thought that by just installing the XCode Tools I was going to be able to compile c programs, but I guess i was wrong :dummy:

In advance, thanks for your help
QUOTE Thanks
lil
Guest
 
Posts: n/a

You forgot the h on stdio (you have <stdio.>) :flower: e.g:

/* sample program */

#include <stdio.h>

void main()
{
printf("Hello Mac Forums!\n");
}

/* end code */

Hope this helps!
Vicky :flower:
QUOTE Thanks
lzco
Guest
 
Posts: n/a

Hi Vicky,

I still haven't sold my problem... I tried your sample program and it gives me the same error.

Quote:
ibook:~/Documents era$ gcc hello.c
hello.c:3:19: error: stdio.h: No such file or directory
hello.c: In function 'main':
hello.c:7: warning: incompatible implicit declaration of built-in function 'printf'
hello.c:6: warning: return type of 'main' is not 'int'
ibook:~/Documents era$ cat hello.c
/* sample program */

#include <stdio.h>

void main()
{
printf("Hello Mac Forums!\n");
}

/* end code */
ibook:~/Documents era$
Any suggestions as to how to install gcc, it seems like the XCode installer doesn't let me compile from Darwin

Thanks,

lzco


Quote:
Originally Posted by lil
You forgot the h on stdio (you have <stdio.>) :flower: e.g:

/* sample program */

#include <stdio.h>

void main()
{
printf("Hello Mac Forums!\n");
}

/* end code */

Hope this helps!
Vicky :flower:
QUOTE Thanks
fearlessfreap24

 
fearlessfreap24's Avatar
 
Member Since: Feb 09, 2005
Location: Near San Diego, CA
Posts: 2,339
fearlessfreap24 is just really nicefearlessfreap24 is just really nicefearlessfreap24 is just really nicefearlessfreap24 is just really nice
Mac Specs: MacBook Pro 13" | MacBook Pro 13" | Mac Mini 2GHz C2D

fearlessfreap24 is offline
i would try to reinstall XCODE. maybe something did not get installed correctly.

QUOTE Thanks
lil
Guest
 
Posts: n/a

Try using spotlight (command + space) to search for stdio.h or just .h for any include files.

Vicky
QUOTE Thanks
lzco
Guest
 
Posts: n/a

I uninstalled XCodeTools, and installed it back again.
Now it works, I don't know what went wrong the first time, but I can compile c programs now.

thanks! :dive: :dive:
QUOTE Thanks
lil
Guest
 
Posts: n/a

Great, glad it's sorted. I must install XCode myself sometime, but I have enough projects as it is to concentrate on, let alone programming!

Vicky :flower:
QUOTE Thanks

Post Reply New Thread Subscribe


« Features I miss from Visual Studio, now using xCode... | I/O Kit and PCI Driver Questions »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Shocking: No GCC installed? AlexN OS X - Operating System 3 09-24-2005 06:27 PM
Can't find August 2003 gcc updater suprmallet OS X - Development and Darwin 0 04-18-2005 10:30 AM
GCC error the_jesus OS X - Development and Darwin 0 07-17-2004 07:04 PM
GCC Version Selection anthonyqkiernan OS X - Development and Darwin 0 01-04-2004 03:03 PM

All times are GMT -4. The time now is 03:22 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?