Wintel CodeWarrior QuickStart
This document should help you to start programming in C++ using the Metrowerks
CodeWarrior IDE (integrated development environment) on a Windows machine.
- Print out this document.
This is so you can have the
instructions next to you without trying to flip between the web page and the
IDE.
- Start up the CodeWarrior IDE.
IDE locations are
listed on the EECS 280 "Current status of programming environments" web page,
located off of the main EECS 280 web page. If CodeWarrior does not appear at
the location on the menus specified in the "Current status" web page, email
280helpw99@umich.edu and caenhelp@umich.edu with the name of the machine that
has this problem, and try another machine.
- Figure out which project stationery to use.
Once you can start CodeWarrior, select "Metrowerks" under the "Help" menu.
Note the IDE version number. It should be 3.0 or 3.1.
- If the version number is 3.0, use the "Win SIOUX C++ App"
stationery in the next step.
- If the version number is 3.1, use the "C++ Console App"
stationery in the next step.
- Open a new project.
Select "New Project..." from the
"File" menu. In the "New Project" window that appears, select the project
stationery specified in the previous step. If it is not visible, find it in
the hierarchy: Expand "Win32-x86" by clicking on the plus sign to its left,
and then "C, C++".
- Save the project.
A dialog box for saving your
file appears. Navigate to a directory to which you have write access, such as
"C:\temp\". Save the project with a meaningful name, such as "Assignment 1
Project". This will create a project folder with the project name you have
chosen, with a number of project-related files in the folder. One of the files
will be the project file, with the project name you have chosen. A project
window will appear.
- Run the default "main.cpp" program.
Select "Run"
from the "Project" menu. This will compile and run the "main.cpp" program that
was created with the project. If you get an error at this point, you either
selected the wrong stationery or CodeWarrior is not installed correctly.
Notice that the red check marks in the project window disappear as files are
compiled.
- Examine the output of the program.
A console
window appears with the text "this is a test". This the output from the
"main.cpp" program running as a separate Windows application. Select "Exit"
from the "File" menu to quit this application. Don't save.
- Create your source code file.
Select "New" from
the "File" menu. Save this file with a meaningful filename in the project
folder you just created, putting a ".cpp" extension at the end of the filename.
- Write your program.
Type your source code into the
file you created. Save often.
- Add your source code file to the project.
In the
project window, click on the group title "Sources" to make it active. Select
"Add Files..." from the "Project" menu. If your source code filename does not
appear, either you did not use the ".cpp" extension or you just need to
navigate through the file hierarchy to find it. Select your source code file.
Click on "Add" and "Done".
- Remove the "main.cpp" file from the project.
Otherwise, you will get an error because you've defined more than one "main()".
In the project window, expand the "Sources" group. Both the "main.cpp" file
and your new source code file should be in the group. Select "main.cpp".
Select "Remove Selected Items" from the "Project" menu.
- Run your program.
First, make sure that you have
quit your previous console application or you will get an "Error writing output
file". Second, select "Run" from the "Project" menu. If it compiles and runs,
congratulations! If an "Errors & Warnings" window appears and no console
window appears, then you need to study the errors and fix your code.
- Save your work.
At the very least, save your
".cpp" source code file. Better yet, save the whole project folder; this way,
you avoid having to create a new project next time. Save your work on two
separate floppy disks.
Hint:
If you find yourself using a menu item often, note the command-key equivalent
next to the menu item and use it instead.
A.Hornof 1/19/99