Results 1 to 7 of 7
  1. #1
    lzco
    Guest
    Unhappy gcc compiler, no stdio.h found
    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:


    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

  2. #2
    lil
    Guest
    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:

  3. #3
    lzco
    Guest
    Hi Vicky,

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

    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:

  4. #4

    fearlessfreap24's Avatar
    Member Since
    Feb 09, 2005
    Location
    Soon to be DFW
    Posts
    2,339
    Specs:
    MacBook Pro 13" | MacBook Pro 13" | Mac Mini 2GHz C2D
    i would try to reinstall XCODE. maybe something did not get installed correctly.

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

    Vicky

  6. #6
    lzco
    Guest
    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:

  7. #7
    lil
    Guest
    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:

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. no acceptable C compiler found in $PATH
    By bippity in forum OS X - Operating System
    Replies: 15
    Last Post: 03-29-2012, 08:47 PM
  2. gcc command not found
    By frike in forum OS X - Development and Darwin
    Replies: 7
    Last Post: 05-16-2011, 11:50 AM
  3. Installing GCC compiler to usr/local/bin
    By KBG in forum OS X - Development and Darwin
    Replies: 3
    Last Post: 05-13-2011, 09:20 PM
  4. Problem with installing GCC compiler
    By aloknabi in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 01-11-2010, 03:31 AM
  5. cin, cout recognized with <stdio.h>, not with <stdio>
    By MichiganDavid in forum OS X - Development and Darwin
    Replies: 5
    Last Post: 02-10-2009, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •