Programming problem

polykodek

Registered
Hi folks,

Basically, i'm in a bit of a dillema. I'm currently taking a computer science degree (first year) in uni. C++ is pretty much okay at this point; unfortunately, my PC recently ran into some 'issues', so i'm having to frequently visit the labs on campus to do my work (visual basic 6.0).

Anyway, my room-mate has a powerbook, running OSX. I've been told that I can use it to do some C++ programming while the labs are closed, but I have no idea on where to start. He has Xcode installed on the laptop, if its any help.

I'm completely new to all of this; first time i've even touched a mac, let alone use one! Any help will be appreciated.

Cheers,

Al
 
polykodek said:
Hi folks,

Basically, i'm in a bit of a dillema. I'm currently taking a computer science degree (first year) in uni. C++ is pretty much okay at this point; unfortunately, my PC recently ran into some 'issues', so i'm having to frequently visit the labs on campus to do my work (visual basic 6.0).

Anyway, my room-mate has a powerbook, running OSX. I've been told that I can use it to do some C++ programming while the labs are closed, but I have no idea on where to start. He has Xcode installed on the laptop, if its any help.

I'm completely new to all of this; first time i've even touched a mac, let alone use one! Any help will be appreciated.

Cheers,

Al
Need more info about the compiler you're using at uni.

One thing for sure though: You'll have a uni account that you'll be to log into via the internet (using Terminal application on OSX) and thereby be able to edit/compile/run the code using the uni's resources.

Kap
 
For my classes the school has an Alpha 4/5000. Both it and my PB have gcc 3.3.* installed. All my code that I write on my laptop works on any other *nix OS I have tried it on:

Solaris x86/SPARC 7/8/9/10
FreeBSD 4.x 5.x on x86/Alpha/SPARC
OpenBSD 3.x on SPARC/Alpha/x86
Linux (SuSE, RedHat) (2.4.x and 2.6.x) on x86

I just open a Terminal window, go to the directory (/Users/bob/labs/*)
and then use vi (VIsual editor) to write the code
(gcc -Wall -pipe -o <outfile> <file to compile>)
or (g++ -Wall -pipe -o <outfile> <file to compile>

Its kinda neat to be able to write code for my servers (SPARC/Alpha/x86)
on my PB, when the windows guys have to ssh to the server.
 
RealBasic is good for application development, but for understanding the fundamentals of computer science, such as object-oriented programming, data structures, and algorithms, you usually need a language that lets you just dive in and, say, program a stack class without all the graphic interface overhead provided by something like RealBasic. C++ offers advantages like simple source files (doesn't mean simple code, but you don't need a lot of files), very small storage requirements, fast compile times, and simple execution from the command line. And these are great benefits when learning computer science.
 
Al,

I'm a little confused. It sounds like you're taking a C++ class, but then you also mention VisualBasic? Which is it that's required for your class?

If it's VisualBasic, the closest thing on the Mac would be RealBasic.

If it's C++, then you already have the compilers and IDE installed. The IDE is XCode, and you can use it to create your projects. For most computer science classes, you'd want to use a project type of "Standard C++ tool" which is a command-line program.

Or, if you prefer, you can just use gcc from the command-line like you would with any Unix system.

One thing you would want to do is to use conditional compilation for anything you run across that's Mac-specific. You want your professor to be able to just compile and run on whatever system they're testing your program on. If it has any kind of error, he's probably going to mark off if it doesn't run on the first try.

For most programs, that won't be any issue at all. But let's say you were doing an OpenGL program.

You'd want to write:

#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif

so that the program would compile correctly on the Mac and on the professor's system.

Hope this helps,

Wade
 
Yeah, now that Wade mentions it, why do you mention Visual Basic when you're talking about C++? Do you mean Visual Studio? I know VB is part of VS .NET 2003, is it part of VS 6.0 as well?
 
Back
Top