bok
bok

Reputation:

I need a simple way to compile C++ code on a Mac intel, for the purpose of learning C++. I

I have a text book already and need a painless!! way to write and test the code

Upvotes: 0

Views: 3402

Answers (6)

If, for some reason, you don't want to use Xcode, you could install fink , then do a

fink install g++ make

which will give you the basics of a unix command line build environment (like most tutorials assume you have). I think you need to install the stuff from the developers DVD too, so you should really consider just using Xcode.

You might also want to

fink install emacs22-carbon

but that depends on your choice of editor. You probably need to install a few libraries and such as you go along.

Upvotes: 0

Mr.Ree
Mr.Ree

Reputation: 8418

Since this guy is just starting out...

Bok, you want to run "g++", or /usr/bin/g++, on your program source file in a terminal window. (Things will go easier if your source file ends in .cc, .cxx, or .cpp.)

E.g.:     g++ foo.cc -o foo -Wall

g++ is installed when you install the OSX SDK from the disks that came with your computer... (Apple's Software Development Kit is not installed by default. But it is included, for free, with every Apple computer sold.)

Upvotes: 3

Adam Hawes
Adam Hawes

Reputation: 5449

If you install Xcode from the DVD supplied with your mac Gcc and friends will wind up in your path. You can use them from the command-line just as you would on any other (Unix-y) OS that supports Gcc.

Vim is pre-installed on the Mac and with a bit of tweaking in ~/.vimrc you can edit C++ code there.

You're not tied to using Xcode if you find it painful.

Upvotes: 1

crashmstr
crashmstr

Reputation: 28573

You can create "Command Line Utility" apps in C++ using XCode (Project -> New)

Upvotes: 2

Paul Nathan
Paul Nathan

Reputation: 40319

Your OSX DVD will have a "SDK", or Software Development Kit. Install that, and it will provide XCode and GCC, which are tools to compile with.

Upvotes: 6

Jim Blizard
Jim Blizard

Reputation: 4253

XCode or GCC will nicely for you I think.

Upvotes: 0

Related Questions