Numerical Methods, MAT 350
Autumn 2001
Using Code Warrior
Code Warrior is a compiler for C, C++, Java, etc. It
is available in the SE 122 computer lab. Here is how to get started:
- Fire up Code Warrior by clicking on the icon.
- Go to menu "File"
- Select menu item "New..."
- You are now in a window that lets you create a new "project."
- Select
Win32 C/C++ Application Stationary
.
- Select a directory save your project in. It should be on the
d:
drive (In the future, only the d:
drive will be writable).
- Give your project a distinctive name. I called mine "junk"
- Click "OK"
- A small window will appear. If you want to compile a C or C++ program,
select
WinSIOUX C++
. This means that the
program will run on a terminal-type window on the screen.
- Now the "project window" should appear. You will see several "folders"
in the window, including one called "source." This is where your
programs will go. To open this folder, click on the
+ next to the folder.
In the folder you will see a file called
main.c
.
- You can open this file (by clicking twice on it) and write your
program.
- "main.c" is a rather generic name and you might want change it to
something more informative like "junk.c." Got to the menu "File"
and select "Save As.." and save your program. In any case, you
should save your program before compiling ... in case your Microsoft
Windows machine decides to crash.
- To compile and run your program, click on the triangle in the
"project window."
- If the program compiles successfully, the program runs and
a window appears showing the results.
- If compilation was unsuccessful, then a window appears showing
the location of the error.
- If you want to add a file to the "project," such as a
subroutine downloaded from the Internet, go to the
menu "project," select "add files," and proceed from there.
- Normally, your program will print to the screen.
You can get a copy of this by using
the "Mark", "Copy," and "Paste" icons on the window
containing the output of your program.