Thread: having trouble to print helo world....

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    32

    having trouble to print helo world....

    I am using a mac, and I wrote a simple code using Xcode

    Code:
    #include <stdio.h>
    int main () {
       printf ("hello world\n");
       return 0;
    }
    I saved it as testing.c then I go to terminal and compile it
    gcc testing.c

    then it gives me the following error:
    testing.c:1:19: error: stdio.h: No such file or directory
    testing.c: In function ‘main’:
    testing.c:5: warning: incompatible implicit declaration of built-in function ‘printf’

    how come...?

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    I know nothing about Apple products, such as Mac OS, so I can't provide specifics. However, you get this message because you don't have the development packages installed or setup properly. On Linux (Ubuntu in particular), you can install the "build-essentials" package I think it is called. Maybe try re-installing XCode, ensuring "all" features/libraries/development tools are also installed. Otherwise, search around for what required development package you need to install, specific to your OS.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    having trouble to print helo world....
    This is the world where everyone has helo-copters, right?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Print Randomly!
    By davewang in forum C Programming
    Replies: 3
    Last Post: 12-09-2008, 09:04 AM
  2. Print function: sending a function.. through a function?
    By scarlet00014 in forum C Programming
    Replies: 3
    Last Post: 11-05-2008, 05:03 PM
  3. merging linked lists
    By scwizzo in forum C++ Programming
    Replies: 15
    Last Post: 09-14-2008, 05:07 PM
  4. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  5. How to print out the data throw printer.Attn Salem
    By Jason in forum C Programming
    Replies: 2
    Last Post: 09-23-2001, 05:58 AM