Benches MacBooks

15

Programming C++ on MacBook

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

For the life of me, I can not get an answer on where to find the environment on my MacBook to start practicing C++. I've looked everywhere and all I can find is that I need to get to the gcc or gcc+ application. I really don't know what this means, as you can tell, I'm new to the Mac world. Any help would be greatly appreciated.

Thanks

15 replies

Sign in or join Beachball Help to reply.

  1. 0

    a brody

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The discs that came with your MacBook include Developer tools. There is a forum specifically for developers under Mac OS X Technologies who can help you get familiar with them as well as this website:

    http://developer.apple.com/

    I'll ask a moderator to move your thread.

  2. 0

    laundry bleach

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    C++ development can be done with XCode. You'll need to install XCode from the install disks that came with your MacBook. It gets installed at the root level of your hard drive in a folder called
    Developer. Inside that look for the Applications folder - XCode is there. If you can't find the installer, go to developer.apple.com - it is a free download. Registration is required but it is simple and painless and free.

    Once you install the developer tools, look around the developer web site. There are lots of good things to check out there, including tutorials.

    If you want to do text only c++ programs, use the g++ compiler. You can access it through the Terminal (in /Applications/Utilities). There are a number of other programming languages available there, including Ruby, Python, Java and Perl.

    Best of luck.

  3. 0

    kuoasis

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Great! Thanks for the help.

  4. 0

    kuoasis

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    On this same topic, can someone please advise on how to actually test out (compile) on Mac? I'm new to both C++ as well as Macs and I'm having trouble getting through this textbook on C++. I know this is a vague request, but any help would be great.

    Thanks.

  5. 0

    kuoasis

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I have an updated request, if someone could please help.

    Thanks.

  6. 0

    sptrakesh

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Compilation is the same on just about every platform (that runs gcc that is). The book you are using to learn C++ should give you the command line to use. If you use Xcode, then just Build or Build & Run should do the equivalent.

    g++ test.cpp

  7. 0

    laundry bleach

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Open the Terminal program (located in /Applications/Utilities/Terminal) and at the prompt, type the following:

    g++ YourFileName.cpp

    There are a bunch of options you can use with g++ (type man g++ at the prompt to find out about these) but that will produce either a bunch of errors (if you are normal and have not fixed all the problems yet) or a working file you can run by typing ./a.out in Terminal.

    Hope this helps you.

  8. 0

    kuoasis

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks for the support laundry, however, I'm still not getting the results I want. When I open a new Project in Xcode and I can not get the following code to execute. I'm so frustrated. Anymore help would be greatly appreciated.

    #include <isostream>

    using namespace std;

    int main(int argc, char* argv [])

    {

    //Without "using" statement, this would be std::cout

    cout << "Hi There!" << end1; // "end1" = next line

    return 0;

    }

  9. 0

    sptrakesh

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    What template did you use to create your project. I did a quick test with a Command Line Utility -> c++ project and "Build and Go" works fine. You can use the Run->Console to view the output. You can also tail /var/log/system.log for the same (if you are administrator).

  10. 0

    laundry bleach

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The only problem I can see with your code is the output statement:

    cout << "Hi There!" << end1; // "end1" = next line

    should be

    cout << "Hi There!" << endl;

    You put a numeral one rather than a letter L in endl.

    Best of luck.

  11. 0

    X_console

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Also... it's not isostream. It's iostream.

  12. 0

    kuoasis

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Laundry,

    You're the best! Took your advice and I got it working.

    Thanks again.

  13. 0

    laundry bleach

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    You're the best! Took your advice and I got it working.

    Hardly the best, but I'm glad we got you going.

    Best of luck.

  14. 0

    Tod Kuykendall

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Kuoasis, if you're up and running go ahead and mark this thread "Answered".

    It's also good form to award "helpful" and/or "solved" points to people who provided answers and advice and helped you out.

    Glad it's working for you.

    =Tod

  15. 0

    kuoasis

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks again everyone.