Programming C++ on MacBook

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

MacBook, Mac OS X (10.5.6)

Posted on Apr 29, 2009 10:09 AM

Reply
15 replies

Apr 29, 2009 11:06 AM in response to kuoasis

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.

Apr 30, 2009 10:27 AM in response to kuoasis

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.

May 1, 2009 10:45 AM in response to laundry bleach

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;
}

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Programming C++ on MacBook

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.