Printf() Not Working

Discussion in 'Mac Programming' started by Halfmaster1, Dec 28, 2010.

  1. Halfmaster1 macrumors newbie

    Joined:
    Dec 28, 2010
    #1
    Hello. As you can see, I'm new here, so I'm probably breaking some rule, but oh well. I have read pa very good tutorial in c, and I decide to try it. I already know GML, which is very similar to c. I think it actually turn the GML to c++ before compiling it, but that's beside the point.


    Anyways, I downloaded Xcode, (I have snow leopard by the way), and I went back to the start of the tut, and it said to run the default code to make sure it works, and I did, but the words hello world didn't appear. As a matter a fact, nothing much happened at all. A bar popped up for a moment, not long enough to read, then it said it had compiled successfully, but the running window didn't pop up. I think it has something to do the the pound include at the to ( which is there) but I don't know what. Please help, I'm really excited to try it out.

    And, I know there are some other #include things for the start, what are some that I should include, and what's the bool one again?

    Thsnkyou.
     
  2. cherry su macrumors 65816

    cherry su

    Joined:
    Feb 28, 2008
    #2
    If you're in a .c file, #include <stdio.h>

    If you're in a .cpp or .cc file, #include <cstdio>
     
  3. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    I can't remember if the menu is Run or Compile, but choose Console from one of those menus. This is where you'll see console I/O.

    -Lee
     
  4. Sander macrumors 6502

    Joined:
    Apr 24, 2008
    #4
    I think even Brits call it "hash include", not "pound include". But please do correct me if I'm wrong...
     
  5. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #5
    Correct.

    Calling the # symbol pound seems to be an American trait. At least Americans are the only people I have ever heard use that name.
     
  6. Halfmaster1 thread starter macrumors newbie

    Joined:
    Dec 28, 2010
    #6
    Okay.

    Just double checking.

    printf(string)

    should display that string in a window, no?

    Because it doesn't.
     
  7. lee1210, Dec 29, 2010
    Last edited: Dec 29, 2010

    lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #7
    No. It writes to stdout. If you run from Terminal it will show up there, if you run from XCode you need to bring up the console as I said earlier.

    -Lee

    EDIT: I just looked at GML. It is close enough to C to make you think you know some C, but far enough away that you need to treat C as something brand new, and assume you know absolutely nothing about C syntax and behavior.
     
  8. Halfmaster1 thread starter macrumors newbie

    Joined:
    Dec 28, 2010
    #8
    Thanks. I thought you were talking about something else entirely.

    It's now generating primes, it's up over 1,000,000 already. Still probably a few hours to go. Might jump ahead, to a much higher number.
     

Share This Page