compiling C on OS X Leopard

Discussion in 'Mac Programming' started by Dr_Maybe, Nov 24, 2008.

  1. Dr_Maybe macrumors 6502

    Dr_Maybe

    Joined:
    Sep 17, 2003
    Location:
    South America
    #1
    I have the dev. tools installed, but when trying to compile a simple hello world "gcc hello.c" app I get:

    stdio.h: No such file or directory

    How do I compile a simple C app on Leopard?

    It's hard googling for the problem, because "c" is just a letter.
     
  2. SydneyDev macrumors 6502

    Joined:
    Sep 15, 2008
    #2
    Make sure it's #include <stdio.h> and not #include <stdio>
     
  3. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
  4. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #4
    The first thing to suspect is that the error message is literally true, that you don't have a file named "stdio.h". Use Spotlight to check. You should have it if you installed the Apple dev. tools, xcode and all that, But the keyword here is "should".

    About Google: The best way to use it is to cut and paste gcc's error message and place it in quotes. So in this case it would be "stdio.h: No such file or directory" (with quotes)
     
  5. Dr_Maybe thread starter macrumors 6502

    Dr_Maybe

    Joined:
    Sep 17, 2003
    Location:
    South America
    #5
    You made me look at the code again :)

    I had just copy-pasted it from a tutorial. There was an error in it, so I fixed it and then it worked. :eek:

    Thanks for the replies. It works now :)
     

Share This Page