or Connect
AppleInsider › Forums › Software › Mac Software › I need to use C++ on my Mac.
New Posts  All Forums:Forum Nav:

I need to use C++ on my Mac.

post #1 of 16
Thread Starter 
Hello!
We are taught C++ at our college. There, we just launch Turbo C++ and start typing. But how do I write C++ programs on a Mac? Is there something like Turbo C++ available? A search on MacUpdate did not reveal anything at all.
Thank you!
-Aayush Arya
Macworld and Apple Matters Author

Reply
-Aayush Arya
Macworld and Apple Matters Author

Reply
post #2 of 16
XCode
post #3 of 16
And it comes on your Mac's System Install and Restore Disks. Latest version, 2.4.1, is available online at http://developer.apple.com/. get a free account, log in and go to downloads. It weights about 750MB.
.
Reply
.
Reply
post #4 of 16
Thread Starter 
Isn't that overkill?

I found two applications - CPP Edit and TryC. Are they any good? Are there any other alternatives?
-Aayush Arya
Macworld and Apple Matters Author

Reply
-Aayush Arya
Macworld and Apple Matters Author

Reply
post #5 of 16
Overkill? Not really. Turbo C++ is an integrated IDE. So is XCode.

I mean, if you really want to go minimalist, you could just use vi and g++ in the Terminal.
My brain is hung like a HORSE!
Reply
My brain is hung like a HORSE!
Reply
post #6 of 16
Funny.. I remembered that gcc comes in the base install but apparently only javac does, and gcc inside Dev Tools.

Anyway, for someone new to C++ and... other scary things... vi's a little harsh. And I say that as a regular vim user. I'd say an easy GUI editor (?) and g++ would be best.

Having learned that route, one can always jump into an IDE and knows what everything means. Starting from an IDE and growing a dependency makes people very uneasy to step outside it because the IDE does so much different stuff, it seems like magic. I'm sure Kickaha will disagree here
post #7 of 16
Feh. I cut my teeth on a Z19 terminal. I *still* do 90% of my programming outside of IDEs of any sort, and it wasn't until two years ago that I started using a GUI text editor (TextMate - utterly rocks) over vi. Most of the environments I work in these days don't have anything resembling a IDE anyways.

Make for the win.

I'm a firm believer in knowing what's going on under the covers of my tools. When I started learning Xcode, I was constantly checking tool chain arguments, XML files, etc, etc, just so I could step in and override when necessary.

IDEs are great for getting you going along an established workflow, but setting *up* that workflow can suck green goats.

Know your tools, from the bottom up, is my feeling.


OTOH, when you're in a class setting, getting the grade is the goal, not necessarily learning the tools (curse you educational system!). In that case, whatever makes your life easier so you can concentrate on whatever hoops the prof wants you to jump through is best.
My brain is hung like a HORSE!
Reply
My brain is hung like a HORSE!
Reply
post #8 of 16
Thread Starter 
I'm sorry for bumping an old thread but I still haven't gotten the reply I wanted to hear and I saw no point in starting a new thread.

Could someone just explain to me in layman's terms what exactly I need to do to compile my CPP files, i.e. those created on Windows using Turbo C++, on Mac OS X? If it can be done using the Terminal, how exactly do I go about doing it?

Thanks in advance.
-Aayush Arya
Macworld and Apple Matters Author

Reply
-Aayush Arya
Macworld and Apple Matters Author

Reply
post #9 of 16
If your C++ projects are targeted for a POSIX platform (they reference the standard C/C++ libraries and that's about it), you can compile them in the terminal with gcc. If you don't know how to do that, ask for your money back on that class you took.

If your projects are targeted for windows or "Turbo C++," whatever that is, you may need to port them. Without knowing what you have done, it's hard to give you specific advice: other than reminding you that XCode is still the best solution here. It has many options, and last I checked it could be set up to compile to a POSIX shell, which I suspect is what you're trying to do.
Cat: the other white meat
Reply
Cat: the other white meat
Reply
post #10 of 16
Quote:
Originally Posted by aryayush View Post

Could someone just explain to me in layman's terms what exactly I need to do to compile my CPP files, i.e. those created on Windows using Turbo C++, on Mac OS X? If it can be done using the Terminal, how exactly do I go about doing it?

First, tell us what you are doing. Is this a "learning beginning C++" exercise and you are basically using cout/cin and the << and >> operators to output and input the program's data? Of are you trying to take advantage of Turbo C++ specific features? C++ is the ultimate in being able to use extensible libraries, but those libraries may have platform-specific underbellies that are hidden -- abstracted, actually -- away from you. (Step into cout sometime with your debugger, lotsa hairy C code in there...)

If you were creating a command-line program to get some data, put it into some basic C++ objects (maybe even manipulating an array of pointers to inherited instantiations of those objects for polymorphism), fold/spindle/mutilate and output the results to demonstrate features, your C++ needs could probably be met with g++, etc.

Instead, if you are developing a professional looking GUI application, well that would be a beast of a different color.

So tell us what you are trying to do and we'll tell you how low-end you can go.

Edit: IMO, an integrated interactive debugger is worth its weight in gold. Its one thing to be able to look at the addresses stored in a pointer, its another to be able to automatically de-reference the value or object in that address to something understandable. In my earlier ramblings, if you had an array/linked list/whatever of pointers to a group of objects, its really nice to be able to set a breakpoint, and not only evaluate whether that pointer is valid or if it points to garbage. But to be able to de-reference the pointer to an object that, say, has a name property or a getName() method to see if its the object you thought it was... You don't get that creating a make file and running some .cpp code into a compiler.

  Google Maps: ("Directions may be inaccurate, incomplete, dangerous, or prohibited.")

 

  MA497LL/A FB463LL/A MC572LL/A FC060LL/A MD481LL/A MD388LL/A ME344LL/A

Reply

  Google Maps: ("Directions may be inaccurate, incomplete, dangerous, or prohibited.")

 

  MA497LL/A FB463LL/A MC572LL/A FC060LL/A MD481LL/A MD388LL/A ME344LL/A

Reply
post #11 of 16
Quote:
Originally Posted by John.B View Post

Edit: IMO, an integrated interactive debugger is worth its weight in gold. Its one thing to be able to look at the addresses stored in a pointer, its another to be able to automatically de-reference the value or object in that address to something understandable. In my earlier ramblings, if you had an array/linked list/whatever of pointers to a group of objects, its really nice to be able to set a breakpoint, and not only evaluate whether that pointer is valid or if it points to garbage. But to be able to de-reference the pointer to an object that, say, has a name property or a getName() method to see if its the object you thought it was... You don't get that creating a make file and running some .cpp code into a compiler.

Meh... just don't write so many bugs into the code.
Cat: the other white meat
Reply
Cat: the other white meat
Reply
post #12 of 16
Quote:
Originally Posted by Splinemodel View Post

Meh... just don't write so many bugs into the code.

In the real world, you don't have the luxury of writing all your own code.

From my experience, the guy who says his code is 100% bug free is either delusional, writing only toy programs, or both.

  Google Maps: ("Directions may be inaccurate, incomplete, dangerous, or prohibited.")

 

  MA497LL/A FB463LL/A MC572LL/A FC060LL/A MD481LL/A MD388LL/A ME344LL/A

Reply

  Google Maps: ("Directions may be inaccurate, incomplete, dangerous, or prohibited.")

 

  MA497LL/A FB463LL/A MC572LL/A FC060LL/A MD481LL/A MD388LL/A ME344LL/A

Reply
post #13 of 16
Quote:
Originally Posted by John.B View Post

In the real world, you don't have the luxury of writing all your own code.

From my experience, the guy who says his code is 100% bug free is either delusional, writing only toy programs, or both.

I'm glad you found it funny. I wasn't sure if the sarcasm would work via the web.
Cat: the other white meat
Reply
Cat: the other white meat
Reply
post #14 of 16
But I have tried X Code, Code Blocks and eclipse on my mac but sadly none of them have compilers as they can't even run a simple display program. But I really like the ide of XCode. Only if there was a way to compile and run the programs.
post #15 of 16
Xcode is built around gcc. You may also access gcc from the Terminal command line.
post #16 of 16
Quote:
Originally Posted by bharath View Post

But I have tried X Code, Code Blocks and eclipse on my mac but sadly none of them have compilers as they can't even run a simple display program. But I really like the ide of XCode. Only if there was a way to compile and run the programs.

You need to read the documentation a little before getting distraught. They ALL are include compilers, and all will compile files, build executables and launch them via their IDE GUIs.

Look up 'build' and 'compile', I'm sure you will find what you need there.
.
Reply
.
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Mac Software
AppleInsider › Forums › Software › Mac Software › I need to use C++ on my Mac.