Compiling on Win95 and Running on the Mac with Codewarrior

Last updated May 31th, 1997

Helpful tools for Win95

Helpful tools for the Mac

How to Compile "Hello World" on the PC and run on the Mac

  1. Create a new project with "File / New Project / Mac OS / C,C++ / C,C++ PPC". Put the new project in c:\HELLO. This inserts HelloWorld.c into the new project by default.
  2. Change the default name of the executable from "Hello World PPC" to MacHello to make it easier to transfer. You do this by selecting "Edit / Project Settings / PPC Project", and changing File Name under Application Info.
  3. Click on "Make" (the little app icon third from the right) (Compiling isn't good enough; you need to Make to get it to link.)
  4. You should now have an executable file named C:\HELLO\MacHello; its resource fork is named C:\HELLO\resource.frk\MacHello.
  5. Transfer the executable and its resource fork to the Mac.
    1. Make sure your PCExchange control panel is enabled, so your Mac can read and write PC floppies.
    2. Put a blank PC floppy in the PC's drive.
    3. xcopy c:\hello a:\ /s
      This is a cheezy way of copying MacHello and resource.frk/MacHello.
    4. Move the floppy to the Mac, and drag the MACHELLO icon only to a folder on the mac. (Don't drag it onto the desktop; this wouldn't force a copy.)
    5. Set the FileType to APPL and the creator to ???? using ResEdit.
  6. Double-click it.

Other ways to transfer the executable to the Mac

Beyond the simple floppy-and-PCExchange method, there are:

Where is conio.h? How do I implement kbhit() and getch()?

Ron Liechty of Metrowerks answers this question periodically on comp.sys.mac.programmer.codewarrior. Here's his code, wrapped up into a tidy package:

I renamed my file on the PC, and when I transfer it over to the Mac, it has the old name. HELP!

MacBinary appears to store the filename inside its header! You can't rename files when they are in MacBinary format; you have to rename them on the Mac, then wrap them in MacBinary again.

The compiler on the Mac can't find a file which I can see is there!

Other Sources of Mac Programming Info

Dan Kegel
With help from Ron Liechty and Jeremy Leader