C++ Compiler (Don't say XCode)

Discussion in 'Mac Apps and Mac App Store' started by Tallest Skil, Feb 7, 2009.

  1. Tallest Skil macrumors P6

    Tallest Skil

    Joined:
    Aug 13, 2006
    Location:
    1 Geostationary Tower Plaza
    #1
    XCode isn't working as a command line C++ utility for me.

    What other programs could I use?

    I want the equivalent of Bloodshed Dev C++ for OS X.

    Thanks.
     
  2. Tallest Skil thread starter macrumors P6

    Tallest Skil

    Joined:
    Aug 13, 2006
    Location:
    1 Geostationary Tower Plaza
    #3
    Or maybe... I don't know. Maybe I'm just writing it incorrectly.

    Can anyone see anything wrong with this code that would cause XCode to come back with errors?
     
  3. isus macrumors regular

    Joined:
    Jan 13, 2004
    #4
    const char M

    not
    const char 'M'

    Also, you are declaring the variable named M to be a character, which means it won't be able to hold the string "Monday".

    Xcode uses GCC as it's compiler, and it's not Xcode (or GCC's) fault.
     
  4. Tallest Skil thread starter macrumors P6

    Tallest Skil

    Joined:
    Aug 13, 2006
    Location:
    1 Geostationary Tower Plaza
    #5
    You can't declare a string as one character, can you? So remove the quotes, though? Okay.

    Okay, good, that works, but it still wants a semicolon after cout (before the string)... is this where I need the single quotes?
     
  5. isus macrumors regular

    Joined:
    Jan 13, 2004
    #6
    I don't understand the first question. What will print out will most likely not be what you want, though, I can almost guarantee that.

    Second question: I see the other error - on the first cout like, you say:
    cout m << endl;

    cout doesn't work like that, everything has to be after the <<

    Try:
    cout << m << endl;

    edit: why are you trying to use a char variable to hold a string anyway? Save yourself the headache and move everything to a string and call it a day.
     
  6. Tallest Skil thread starter macrumors P6

    Tallest Skil

    Joined:
    Aug 13, 2006
    Location:
    1 Geostationary Tower Plaza
    #7
    I... am an idiot. :p Thank you.

    I already know two real languages and now they expect me to learn a third... what a world. :rolleyes:

    Thank you. Turns out that XCode should do just fine...

    Though my professor said that I should run everything through Bloodshed Dev C++ on a Windows or Linux box before turning it in.

    But would I even need to, or will XCode's work be identical?

    Thanks a lot, again.
     
  7. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #8
    Both Bloodshed and XCode use gcc so as long as you don't use any OS X frameworks, it should be ok.

    But ... I would try compiling your code from the command line first.
     
  8. isus macrumors regular

    Joined:
    Jan 13, 2004
    #9
    I've seen plenty of weird ****, even from gcc itself. For example, I wrote one program in Xcode, it compiled perfectly and ran on my machine perfectly. Nothing extravagant, just a basic CLI like you're attempting to create here. Recompiled the code on the server and it did nothing when executed. I checked that code a dozen times and I could never figure out what happened.

    In short, yes, definitely try to compile the code with whatever your professor wants if at all possible.
     
  9. MorphingDragon macrumors 603

    MorphingDragon

    Joined:
    Mar 27, 2009
    Location:
    The World Inbetween
    #10
    XCode just uses GCC + Make which Dev uses. Unless you code a Cocoa GUI it should work on everything. Doesn't hurt to make sure though, get a Linux VM. (Ubuntu isn't the best for VM, try Fedora 10, not 11 or openSUSE 11.1)

    NetBeanz or Eclipse with the C++ plugins are another option, XCode has a superior design though. That might be because I only Know Cocoa and Objective-C... :D
     
  10. Aron Peterson macrumors member

    Aron Peterson

    Joined:
    May 27, 2008
    Location:
    Kaufman TX, NY and England
  11. Tallest Skil thread starter macrumors P6

    Tallest Skil

    Joined:
    Aug 13, 2006
    Location:
    1 Geostationary Tower Plaza
    #12
    I could never get a simple gotoxy to work, even when I had the proper .h files and copied the code directly. That was my main concern for the class, but XCode always worked for everything else.
     

Share This Page