A note for Macintosh users
Nikolai Ruhe
reports that if you are using MacOS X, you can use GCC to compile
your C++ programs, as follows:
-
Write your source files;
-
Start the terminal application (in the Utilities folder inside the Applications folder);
-
Change to the source directory (e.g. cd src);
-
Type something such as g++ myprog.cpp -o myprog -Wall to invoke the compiler.
If you are using an earlier version of MacOS,
Navid Madani
has suggested a technique that may be useful if you are trying to get
the code from our book to work on a Macintosh.
He has tested it using the
MetroWerks CodeWarrior
compiler.
- Put the line
#include <console.h>
among the header files in your program.
The console.h header is not part of standard C++;
it is defined in the MetroWerks CodeWarrior development environment
as part of MSL (MetroWerks Standard Library).
-
Change the definition
int main()
to
int main(int argc, char** argv)
-
At the beginning of your program, execute the following statement:
argc = ccommand(&argv);
Please note that ccommand is not an inadvertent misspelling of command.
If you change your program in this way, then each time you run it, it
will pop up a dialog box asking what files you want the program to use,
and giving you the opportunity to supply other options.