# Learning C++



## BioCore (Apr 23, 2008)

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.


----------



## Mikuro (Apr 23, 2008)

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).


----------



## Viro (Apr 23, 2008)

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.


----------



## BioCore (Apr 23, 2008)

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++?


----------



## Mikuro (Apr 23, 2008)

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.


----------



## BioCore (Apr 23, 2008)

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?


----------



## Viro (Apr 24, 2008)

You will need to know C before using Objective-C, since Objective-C builds on the C language.


----------

