# C++ on Mac OS X



## G4Mystic400 (Sep 25, 2001)

Hello all! I'm sure you've allready answered this before, but me being the person that I am, why not just let it out of the bag again!

How would I go about programming standard C++ (well as standard as you can get it I suppose)? I just started a C++ class at school, and I must admit that C++ is pissing me off! It is just driving me crazy of how many lines of code I have to do this in! Just for fun I'm also doing all of my projects so far in ANSI C to show the prof why the language is bothering me so much.

Enough of me ranting. Well for now I'm doing it on VisualC++ on my Win2k box, but I would rather have it done on OS X so I can actually be productive with this dev work!

Now I know I have to save the files with a .cpp extension, but I don't know how to compile it. The book and the class are NOT very helpful. I read something about g++ and a c++ app that will compile and link this for me. But someone said something about using project builder (with it's lovely color syntaxing!). Any and all help is greatly appreciated! I like to consider myself someone who would never seem to be a computer idiot, but when i don't know it, who am I not fooling?

-Jim


----------



## rharder (Sep 26, 2001)

I haven't tried using C++ in Project Builder, because it C++ doesn't have access (that I know of) to Cocoa classes.

Anyway, if you're taking a generic C++ class, you won't need Cocoa, so you might be able to do a New Project...C Tool or something.

Otherwise you can save your files with a .C or .cc or .c++ or whatever extension and compile from the command line with cc *.cc (or is it c++ *.cc?)

-Rob


----------



## wadesworld (Sep 26, 2001)

You use a C++ Tool in project builder for building C++ console apps.

Wade


----------



## LordOphidian (Sep 27, 2001)

The command line compiler (that used by Project Builder as well) is GCC, and can be called by c++ (instead of the usual g++).  I have no idea why apple renamed it but they did. Here is an example from one of my projects:

```
$ c++ -g -o project1 project1.cpp
```
You can also use Project Builder to make your C++ projects... use the C++ Tool project type.

As another note, don't use the .C ending, use .cpp or .c++ since you are probably running on HFS+, .C and .c are the same (although case is preserved) so im not sure if the compiler can sort out that you want c++ and not  just c.


----------



## Trip (Oct 5, 2001)

Can I download Project Builder....or does that only come on the Developer CD? Reason: I lost my developer CD.


----------



## jdog (Oct 5, 2001)

Yes, project builder is only available with the Dev Tools, but you can download them from Apple.

-jdog


----------

