tags:

views:

329

answers:

7

I'm looking for a good setup for learning C++ and eventually Python on Mac OSX. As I'm going use C++ I don't want to use XCode, as (I understand) this is primarily used with Objective-C. I have a small bit of experience in Java and MATLAB programming, and math is probably not going to be my main problem. I was thinking on an approach looking something like this:

  1. Work through Accelerated C++.
  2. Write a couple of small math-programs; something like the Mandelbrot set, a PDE-solver, or a graphing-app. This would be done using a widget toolkit.
  3. Write a small game with really crappy graphics. This is probably going to be a rip-off of Jetmen Revival or Space Invaders ;-)
  4. (When I'm fed up with the game not working), work my way through Core Python.
  5. Repeat steps 2 and 3 in Python.

I'm thinking about going with Eclipse and GTK+ / X11. Any thoughts on IDE's and GUI toolkits? Preferably open source, and definitely free. And what do you think about the 5 steps?

Any help would be much appreciated - thanks in advance!

A: 

I'd definitely go GTK+. It is very easy. I'm not sure about graphics libraries on OS X. I know OS X primarily uses Objective-C, but if the native graphics library can be used from C++, use that for game graphics.

As far as IDEs, I don't know. I use GNU Emacs, but I wouldn't recommend that to a beginner. Learning how to use Emacs is like learning a new programming language all by itself. I would start with a basic text editor (look up one with syntax highlighting) and compiling from the terminal for now, so you don't have to learn an IDE too. They make huge projects easier, but can be a PITA for little things.

c4757p
A: 

You can use VIM with cscope and ctags plugins for C++, I personally find that to be the fastest. Eclipse for C++ is also good if you need a gui, but it is not as feature rich as it is for Java but it is a good open source IDE.

In terms of books, Effective C++ and More Effective C++ are good.

Arvind
+3  A: 

As I'm going use C++ I don't want to use XCode, as (I understand) this is primarily used with Objective-C.

XCode is a fine choice, even for pure C++ solutions.

Work through Accelerated C++.

That's the book that got me started! It's an excellent choice, but not a walk in the park. It took me a month or two, at a rate of about 1 to 2 hours a day. But after this you'll have made a MAJOR jump towards becoming a really good C++ programmer.

Write a couple of small math-programs; something like the Mandelbrot set, a PDE-solver, or a graphing-app. This would be done using a widget toolkit. Write a small game with really crappy graphics. This is probably going to be a rip-off of Jetmen Revival or Space Invaders ;-) (When I'm fed up with the game not working), work my way through Core Python (this is a book; max. one link/question for new users...).

Fine, I did Tetris.

Repeat steps 2 and 3 in Python.

I have no experience using Python, but I know it's a much easier language to master than C++. So if you can master C++, Python's won't be any problem.

For GUI you could use Qt, especially now it has been made LGPL. However, Cocoa is interesting as well, if feel courageous enough to also learn Objective-C :) (Btw, there is a Python port for Cocoa as well.)

StackedCrooked
+1  A: 

XCode is a mature IDE well suited to almost any language. C++ is particularly well supported.

Apparently GTK+ has native OSX widget support, though I've never used it, so you could skip the X11 stack altogether if you desired. Other cross platform widget sets include wxWidgets, fltk and Tk.

For games, though, they are less than optimal. for this I strongly recommend LibSDL or its python binding, PyGame. These can provide a convenient, standard interface to OpenGL if you want to use that, or you can use hardware accelerated 2d primitives if that's all you need.

TokenMacGuy
+1 for pygame!!
Jason Baker
A: 
  1. Work through Accelerated C++.
  2. Write a couple of small math-programs; something like the Mandelbrot set, a PDE-solver, or a graphing-app. This would be done using a widget toolkit.
  3. Write a small game with really crappy graphics. This is probably going to be a rip-off of Jetmen Revival or Space Invaders ;-)
  4. (When I'm fed up with the game not working), work my way through Core Python (this is a book; max. one link/question for new users...).
  5. Repeat steps 2 and 3 in Python.

Might I recommend doing this in reverse order with respect to languages? Bear in mind that GTK+ isn't trivial to learn, neither is C++. In fact, I'd really recommend starting out with Cocoa and PyObjC first. Cocoa is a little bit more to wrap your head around, but once you get it down, it's very easy to see its benefit. A development setup of GTK and PyGTK can be a PITA to set up on OS X (at least it was for me).

Jason Baker
+1  A: 

When choosing an IDE, it's very much a matter of taste, so the best choice is probably to try out several for a day or two each. Eclipse and XCode are both popular choices that surely are excellent in their own ways. I can't help you with the widgets, as I know very little about that. GTK+ is a popular framework, but the native OS X support wasn't ready last time I checked, but development is ongoing so this could have changed. Qt is less popular, but is nowadays completely open source, so the licensing issues it used to have are solved now, so you might want to look into that as well. wxWidgets are popular in Python and I found it easy to use, but I don't know if it's as good as the other ones, but it may very well be.

As for the five steps, it makes much more sense to do them in Python first. Python is easy to learn and master, especially if you are NOT tainted by C/C++. C/C++ programmers often has to unlearn things, as there are so many things you must do and think of that you don't have to bother with in Python.

With Python you can concentrate on learning the libraries and tools, instead of having to learn how to not shoot yourself in the foot with C++. Learn C++ afterwards, and you'll have a nicer smoother learning curve, and enjoy yourself more.

Lennart Regebro
A: 

NetBeans is another choice. Although both Python and C++ support are rather new for it. The Python works find, but I haven't tried the C support.

Nosredna