C++ on the Mac

mmmdreg

macrumors 65816
Original poster
Apr 14, 2002
1,393
0
Sydney, Australia
I'm doing computing subjects at uni and we're going to be using C++. What do I need on the Mac to do this stuff? Will the stuff i make work on PC's with a recompile? blah blah.. dev tools?
 

oingoboingo

macrumors 6502a
Jul 31, 2003
988
0
Sydney, Australia
mmmdreg said:
I'm doing computing subjects at uni and we're going to be using C++. What do I need on the Mac to do this stuff? Will the stuff i make work on PC's with a recompile? blah blah.. dev tools?
Mac OS X includes GNU's gcc/g++ compiler and all the supporting tools on the installation media. Also included is Apple's XCode IDE, which is a highly featured GUI environment for developing Objective C/C/C++ and Java applications.

Provided the C++ programs you are developing are written according to ANSI specifications, you aren't making calls to OS-specific libraries (like Microsoft's MFC libraries or Apple's Cocoa libraries), and you have makefiles which cover any platform dependencies (like the location of key libraries) then yes...any C++ program you write on the Mac should recompile with a minimum of headaches on a Windows machine (or a Linux machine, or any other OS with a modern C++ compiler).

In general, Mac OS X is a very good software development platform for many of the same reasons Linux and other Unix systems are: it includes a broad selection of development languages and tools (gcc/g++, Python, Perl, Java, XCode, the CHUD tools) and can take advantage of the huge resource of open source libraries which are available to support these languages.
 

mj_1903

macrumors 6502a
Feb 3, 2003
563
0
Sydney, Australia
In Xcode:

File -> New Project -> Command Line Utility -> C++ Tool.

That project will compile happily on Mac OS X and copied across to Windows/Linux boxen will compile happily as well.

I really feel sorry for you having to learn C++ though. Which uni are you going to?
 

mmmdreg

macrumors 65816
Original poster
Apr 14, 2002
1,393
0
Sydney, Australia
mj_1903 said:
In Xcode:

File -> New Project -> Command Line Utility -> C++ Tool.

That project will compile happily on Mac OS X and copied across to Windows/Linux boxen will compile happily as well.

I really feel sorry for you having to learn C++ though. Which uni are you going to?
Macquarie.. It seems they're very PC-oriented all over. I'm doing B. Com - Actuarial Studies/ B. Sci. - Computing =) Sounds nerdy eh? :p

So will c++ help me on my way to Obj-C?
 

oingoboingo

macrumors 6502a
Jul 31, 2003
988
0
Sydney, Australia
mmmdreg said:
Macquarie.. It seems they're very PC-oriented all over. I'm doing B. Com - Actuarial Studies/ B. Sci. - Computing =) Sounds nerdy eh? :p

So will c++ help me on my way to Obj-C?
I had several friends who did the Actuarial Studies degree at Macquarie (I did Biotechnology there many moons ago). You're in for an absolute arsehole of a time...and if your career leads you into the actuarial world afterwards, then you've got several more years of tough professional-level exams to pass. It's all worth it in the end I guess, since my friends who work in the insurance industry now earn about 4 trillion dollars a year and have barely turned 30.

C++ will help you with Objective C in terms of understanding the basic notions of object oriented programming, and the mechanics of how the C/C++/Objective C family of languages work. There are various differences between the way that C++ and Objective C handle the object-oriented additions to the basic C language though...some concepts don't map straight across. If you're interested in writing Mac OS X software, I think coming to grips with the large Cocoa API and learning to use it effectively will be more of a task than mastering the differences between C++ and Objective C though. Not that you'll have much time for that doing a double degree in Actuarial Studies and Computing ;)
 

mj_1903

macrumors 6502a
Feb 3, 2003
563
0
Sydney, Australia
mmmdreg said:
Macquarie.. It seems they're very PC-oriented all over. I'm doing B. Com - Actuarial Studies/ B. Sci. - Computing =) Sounds nerdy eh? :p

So will c++ help me on my way to Obj-C?
I think it has already been outlined but I would just like to say no, it won't help at all. :) C++ is a nasty hodge-podge of a code base and you will learn so many different ways of approaching the one problem. Obj-C is relatively straight forward and in comparison is a cake walk.

Enjoy the course though. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.