Linux/g++: Maze solving
in CSE326
Linux machines at U. W.
|
|
|
|
Machine Names: Ceylon, Sumatra, Fiji,
Tahiti |
|
http://www.cs.washington.edu/lab/facilities/instr-labs.html |
|
Access |
|
Use X-terminals in back of Sieg 329
(click on one of the linux machine names) |
|
Use Windows machine, ask someone in lab
for help |
Make project directory
Look at supplied files
Copy Files
Interlude: ‘man’
Look at files in my dir
My files are read-only
chmod (thanks to Nic
Bone)
How to make runmaze (the
program)
Test run
Run sample solution
Run runmaze with
visualization
Edit runmaze.cpp – forgot
&
Edit runmaze.cpp
Emacs keys
|
|
|
|
CTRL-X S (hold down control for both
letters) |
|
Save your work |
|
CTRL-X C |
|
Exit emacs |
|
CTRL-G |
|
Abort current command (if you
accidentally typed something wrong) |
|
More: |
|
(Quick intro) http://www.cs.washington.edu/education/courses/cse326/00wi/unix/emacs.html |
|
(official documentation) http://www.lns.cornell.edu/public/COMP/info/emacs/emacs_toc.html |
Simple change to
runmaze.cpp
Re-make program
Run re-made version
Intro to make – project
file dependencies
2 lines from Makefile
g++ linking command line
|
|
|
|
-o runmaze |
|
Call the output file ‘runmaze’ (instead
of a.out, which is the default) |
|
-g |
|
Include debugging information, so you
can use a debugger |
|
-L/usr/X11R6/lib -lX11 |
|
Include X-Windows libraries (for
visualization part) |
2 lines for runmaze.cpp
(well, technically runmaze.o)
g++ compiling flags
|
|
|
|
-c |
|
Only compile, don’t link – we’ll let
make decide when to link. |
|
-Wall |
|
g++ will give us all of the Warnings it
can think of. Maybe it’ll help us
find a bug quickly. |
|
-g |
|
Add debugging information. |
So you want to add a .h
file
|
|
|
Add it to every .o/.cpp that #includes
it, directly or indirectly. |
Adding a .cpp file
Debugging
|
|
|
|
Zasha recommends: |
|
add print statements (or cout<<)
so you can see what your program is doing. |
|
Make them check a global variable
(doDebug), so you can turn them off & on (to turnin for grading) |
|
Learn debugger later. |
|
Or |
|
use gdb (see below) |
|
use xxgdb (has dinky graphical user
interface) |
start it/set a couple of
breakpoints
Run program in gdb
More info
|
|
|
|
326 Computing page (more info on these
tools) |
|
http://www.cs.washington.edu/education/courses/cse326/00wi/computing.html |
|
GNU Info pages |
|
http://www.lns.cornell.edu/public/COMP/info/ |
|
Friendly people in lab / other students |
|
man command |
|
osmosis |