HOWTO: Compile using Metrowerks CodeWarrior
- From a Windows machine on the campus network, navigate to the
folder containing class software for Computer Science.
- Double-click the icon for Metrowerks Code Warrior:
- To create a new C++ project, click the fourth icon on the toolbar:
- 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.)
- To specify the type of project, click to expand Win32 Console App,
and select C++ Console App.
- After clicking OK, CodeWarrior creates a template project with a
standard source file called hello.cpp located in the
Source folder:
- To view and edit the file, simply double-click hello.cpp,
and CodeWarrior displays the file in a new window:
- 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:
- 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.
- 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.
- To add the new file first.cpp to the project, pull
down the Project menu and select the first item.
- Add the file to both the debug and release versions, so click OK on
the following dialog box.
- After adding, drag the file first.cpp into the Source folder.
- 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.
- 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:
- 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.