image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old April 23rd, 2008, 12:27 PM
Registered User
 
Join Date: Sep 2007
Posts: 23
BioCore is on a distinguished road
Learning C++

Hi everyone,

I was interested in learning C++ on my own as a self study. I was wondering if any of you can recommend some good tutorial sites or a book that is good to study from. Now I am not a pure novice as I have taken an introductory course on C and then the teacher also taught us some C++. This was about 3 years ago though and I would like to get back into programming.

So if anyone can help, especially if there are tutorials or books designed at coding on the Mac with XCode.
Reply With Quote
  #2  
Old April 23rd, 2008, 01:03 PM
Mikuro's Avatar
Crotchety UI Nitpicker
 
Join Date: Mar 2005
Posts: 2,415
Mikuro is on a distinguished road
For general C++, I highly recommend http://www.cplusplus.com and http://www.cppreference.com . The first has lots of tutorials and documentation, the second is a great bare-bones reference. Neither is Mac-specific, though. I can't help you there, since I've never done any Mac-specific coding in C++ (I mostly use Objective-C for that).
__________________
Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.2

I'm now a four-browser man. How on earth did this happen?!

Useful programs: PithHelmet, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc
Reply With Quote
  #3  
Old April 23rd, 2008, 02:14 PM
Viro's Avatar
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 2,452
Viro will become famous soon enoughViro will become famous soon enough
You can use C++ in Xcode quite easily. If you're doing console based programs (i.e. the ones that output text to a terminal) the project type you're interested in is Command Line Utility -> C++ Tool. Then add whatever C++ files you need and you're good to go.

Doing GUI related stuff on the Mac in C++ is considerably harder. I'm personally a huge fan of wxWidgets for C++ GUI development and that works great on the Mac too.
Reply With Quote
  #4  
Old April 23rd, 2008, 09:01 PM
Registered User
 
Join Date: Sep 2007
Posts: 23
BioCore is on a distinguished road
Alright thanks for the info guys. I will look into the wxWidgets when I get the time Viro. If you have any good sites that explain would save me time, but if you don't I won't have a tough time.

Mikuro, my main goal is to learn how to make native Mac apps, so in other words something that would use Cocoa and the Apple API's. Would you say that Objective-C is better for this then C++?
Reply With Quote
  #5  
Old April 23rd, 2008, 09:37 PM
Mikuro's Avatar
Crotchety UI Nitpicker
 
Join Date: Mar 2005
Posts: 2,415
Mikuro is on a distinguished road
You can't use Cocoa from C++, actually. C++ apps generally use Carbon, which is widely considered less modern and "Mac-like" than Cocoa, and which Apple seems to only reluctantly support (IMHO).

wxWidgets uses C++ (and many other languages), and has the advantage of being cross-platform. But again, it is not as "Mac-like" as Cocoa.

Cocoa and Objective-C usually go hand in hand. There are Cocoa bridges for other languages (Leopard includes bridges for Python and Ruby, and Java was supported in the past), but Objective-C is the main language.

You can integrate Objective-C and C++ code. Sometimes I use C++ to do some of the core computational tasks of my applications and Objective-C/Cocoa to handle everything else, like the interface. There are some other threads here on that topic.
__________________
Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.2

I'm now a four-browser man. How on earth did this happen?!

Useful programs: PithHelmet, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc
Reply With Quote
  #6  
Old April 23rd, 2008, 11:09 PM
Registered User
 
Join Date: Sep 2007
Posts: 23
BioCore is on a distinguished road
From your explanation Mikuro, seems that Objective C would better for my needs. I was just wondering though, with Objective C I would firstly need to review my C skills and then learn the Objective-C methods, correct?
Reply With Quote
  #7  
Old April 24th, 2008, 12:49 AM
Viro's Avatar
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 2,452
Viro will become famous soon enoughViro will become famous soon enough
You will need to know C before using Objective-C, since Objective-C builds on the C language.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 10:28 PM.


Mac Support® Version 3.7.0 Beta 5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.