HOWTO: Compile using Metrowerks CodeWarrior

  1. From a Windows machine on the campus network, navigate to the folder containing class software for Computer Science.

  2. Double-click the icon for Metrowerks Code Warrior:

  3. To create a new C++ project, click the fourth icon on the toolbar:

  4. Click the Project tab, and select the option for creating Win32 C++ Stationary. In the text field to the right, type the name of the new project. (You may also want to choose a directory for all of your projects.)

  5. To specify the type of project, click to expand Win32 Console App, and select C++ Console App.

  6. After clicking OK, CodeWarrior creates a template project with a standard source file called hello.cpp located in the Source folder:

  7. To view and edit the file, simply double-click hello.cpp, and CodeWarrior displays the file in a new window:

  8. To compile and run the program, click the first icon on the toolbar, the green arrow. Provided there aren't any errors, CodeWarrior will run the program in a DOS Window:

  9. We want to replace the file hello.cpp with our own source file, which we will call first.cpp. To do this, click the third icon on the toolbar, which creates a new window. Type the C++ program into the new window.

  10. Save the file (important!) by pulling down the File menu and selecting the "Save As..." item. Use the file dialog box to save the file with the name first.cpp.

  11. To add the new file first.cpp to the project, pull down the Project menu and select the first item.

  12. Add the file to both the debug and release versions, so click OK on the following dialog box.

  13. After adding, drag the file first.cpp into the Source folder.

  14. Now, delete the file hello.cpp from the project. Use the right mouse button to select the file hello.cpp. This draws up a pop-up menu. Select the Delete item, the last one.

  15. Run the program with the file first.cpp by clicking the first icon on the toolbar, the green arrow. CodeWarrior will run the program in a DOS Window:

  16. If you make further modifications to your program, save the file and click the run icon. CodeWarrior will then compile, link, and execute in one step.