Language: C++
Platform: UNIX (Linux) (UNIX
TUTORIAL)
USING LINUX:
-
TELNET:
-
Start up Telnet on a PC, Mac, ThinkPad, or whatever,
-
then open a connection to euclid.nmu.edu (or cs.nmu.edu
or math.nmu.edu).
-
Then login.
-
VNC: (virtual network computer)
Here
is some additional info for our lab.
GETTING FILES TO YOUR ACCOUNT:
Two methods:
-
Copy and Paste With Browser:
-
Point your browser at the code files in http://euclid.nmu.edu/~jeffhorn/Classes/CS222/Fal11999/HW3"
or
whatever URL, then (using Windows or Mac's OS copy and paste facilities)
grab the source code, open a text file with some editor (e.g., pico)
and paste it in. Save the file with the appropriate file name.
TIME COMSUMING IF YOU HAVE MANY FILES! (although size is no big thing).
-
youUse the unix command.
-
Use the Unix Copy Command as in "cp
source
destination". For example, to get all of the files
for a particular assignment:
-
First create your own subdirectory in your home directory, as in
-
Then cd to HW3:
-
Then copy:
bpitts> cp ~jeffhorn/pub/Classes/CS222/Fall1999/HW3/*
.
EXPLANATION:
-
Note that in the above command, there are two arguments to the cp command,
(1) the source, which is "~jeffhorn/pub/Classes/CS222/Fall1999/HW3/*" ,
and the destination, which is "."
-
The source is an entire path name, including "~jeffhorn", which is just
short for "the homedirectory of user jeffhorn", and the wildcard character
"*" which means all files (and subdirectories, if any) in the "HW3" subdir.
Note that in the destination argument above (namely "."), the "." is a
pointer to the current directory, which happens to be "~bpitts/HW3" because
that is where we cd'd to.
SAMPLE CODE: To try out your C++ development
environment (Turbo C++, gcc, g++, or whatever), you can try compiling and
running the these little programs: sphere.cc
or shapes.cc.
I believe that all you need for these to run is the "iostream.h" header
file, which should be available to your development environment. Try it!
COMPILING:
-
Use the built-in GNU C++ compiler, by typing "g++" at the command line
prompt.
-
Complete syntax:
bpitts> g++ main.cc
-
This will produce a bunch of compiler errors (usual) right aback at you,
or (eventually!) no compilation errors, in which case a new file, called
"al.out" be default, will appear in your current directory (the one you
were in when you ran "g++"!).
-
Run your executable by typing "a.out" at the command line, or, if you get
"command not found", try "./a.out" to FORCE unix to look in your current
directory (which is".") to find a command (or executable, which is all
a unix command really is!) named "a.out"
-
If you prefer a different name for executable (e.g., one more meaningful!),
try
bpitts> g++ main.cc -o myCoolProg
to get g++ to send its output to "myCoolProg" instead of "a.out"
-
or simply rename "a.out" anytime, with the unix MOVE command: bpitts>
mv a.out myCoolProg
-