1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

How to compile/run/ the works

Discussion in 'Mac Programming' started by slooksterPSV, Oct 16, 2004.

  1. macrumors 68030

    slooksterPSV

    #1
    Ok so I just got GCC and those tools installed from the 302.3 MB download from Apple for the Developers tools. Now I'm having a problem. I can compile the programs using GCC, but when I run them nothing appears. Ok will someone give me a example C/C++ code and the commands to use at terminal and how to run the program and what appears after I run it. I'm expecting to see even Hello World, but nothing appears in the terminal.
     
  2. macrumors G3

    iMeowbot

    #2
    This is about as simple as it can get from the command line:

    Code:
    Meowcintosh:~ imeowbot$ cat meow.c
    #include <stdio.h>
    int
    main()
    {
        printf("Meow!\n");
        return 0;
    }
    Meowcintosh:~ imeowbot$ cc -o meow meow.c 
    Meowcintosh:~ imeowbot$ ./meow
    Meow!
    Meowcintosh:~ imeowbot$
    
     
  3. macrumors 68030

    slooksterPSV

    #3
    That one piece of code made it all work the:
    cc -o test_1 test_1.c

    that did it. It all works now, thank you so much
     

Share This Page