Newbie to C++ struggling with mac MPW IDE

Started by
7 comments, last by Zahlman 17 years, 10 months ago
Hi, I am completely new to programming, just getting started with C++ after dabbling a little bit in Python during an introductory computer course that piqued my interest last fall. The tools at my disposal are the "C++ Primer: Fourth Edition" by Lippman, Lajoie and Moo, and the macintosh MPW-GW IDE. I started working through the book using the free Borland C++ compiler on a friend's PC but have just today been trying to switch over to MPW so that I can learn programming on my Powerbook. I am running into problems with the '#include' command when trying to compile my programs. I think the problem lies in the compiler not looking for the appropriate include and library files (the ones that when using Borland had to be specified on the command line with '-If:\...\include' and ''-Lf:\...\library'). My small sample program: #include <iostream> int main() { std::cout << "Hello, World!" << std::endl; return 0; } ...returns the following error: # 8:07:09 PM ----- Build of C++ Primer. # 8:07:09 PM ----- Analyzing dependencies. # 8:07:09 PM ----- Executing build commands. SCpp hello.cpp -o :hello.cpp.o -sym off -model near SCpp C++ Compiler 8.8.4f1 Copyright (C) 1985-1999 by Apple Computer, Inc. #include <iostream> ^ File "hello.cpp"; line 1 #Fatal error: unable to open input file 'iostream' #----------------------- ### MPW Shell - Execution of C++ Primer.makeout terminated. ### MPW Shell - Execution of BuildProgram terminated. ...where 'C++ Primer' is the name of my makefile. I interpret this to mean that MPW does not recognize 'iostream' as a valid argument for '#include'. Is there anyone out there with experience in using MPW who can help me out?
Advertisement
Im not sure, but test drive the following code.
#include <iostream.h>


Hope it works for ya.
On a hunch (based on the copyright date '1999') I did a search for this particular compiler's support for "post C++ standardization" features such as templates, namespaces, the new C++ standard headers and of course, the STL.

The first link I found: http://snow.prohosting,com/guru4mac/stlport_mpw.html
suggests that it does not. It does seem that there is some third-party support though.

You may wish to try your luck with another compiler if this doesn't work for you.
Don't use MPW, I don't think Apple has supported it for a number of years.

If you're running OS X, the installation CDs (or DVD) for the OS should have come with developer tools - newer versions will be have xcode, older versions project builder. If you're running OS X 10.4, you can also download the latest version of xcode from Apple.

As for the error you're getting, my guess is that MPW has a very old or poor C++ implementation. It's possible that you need to use <iostream.h> instead - but be aware that iostream.h is not standard, and really shouldn't be used.
I know it's rather late (I had some hardware issues that kept me away from the internet for a while), but I wanted to thank everyone for their responses. I never did manage to get MPW to do what I needed it to, but on your suggestions I checked out Xcode, and it seems to be working very well for me.
I didn't even know MPW would run under relatively recent versions of Mac OS.

MPW was interesting but had a pretty "un-Mac-like" interface for its time. CodeWarrior was awesome back then... ahh, memories.
I'm surprised MPW works on Mac OS X, considering it stopped working on Classic under Mac OS 8.5. It is ancient.

I'm glad you've moved on to Xcode and GCC4.
MPW would always start up under Classic for me. I was directed to it as the "best" free Mac C++ compiler on another message board. I'm glad I found this site as a resource instead.
Quote:Original post by Ravuya
I'm surprised MPW works on Mac OS X, considering it stopped working on Classic under Mac OS 8.5. It is ancient.

I'm glad you've moved on to Xcode and GCC4.


Uh, 'Classic' is only meaningful in a Mac OS 9 context. 8.x was all implicitly "Classic", and MPW worked just fine for me (to the extent that it ever worked at all) under 8.6.

But yes, it is ancient. And people tended not to support it even when it was current. (I tried using it to build NetHack back in the day, when it wasn't officially supported; I eventually gave up on trying to figure out all the necessary stub libraries.)

This topic is closed to new replies.

Advertisement