To use the Sun
Solaris
Unix host
i5.nyu.edu
,
get your
loginame
(same as your NYU NetID)
and
secret password
(same as your NYU NetID secret password)
if you do not already have them.
Then connect to
i5.nyu.edu
via the Secure Shell protocol SSH.
i5.nyu.edu
from a PC,
download a free copy of
PuTTY
(if you don’t already have it)
and launch it.
Under
Category
,
select
Session
.
Under
Host Name (or IP Address)
,
fill in
i5.nyu.edu
or
128.122.253.152
.
Under
Protocol
,
press the
SSH
radio button.
At the bottom of the window,
press the
Open
button.
Terminal
application of Mac
OS X,
download ssh
(if you don’t already have it).
Run the following command,
typing your loginname in place of
abc1234
.
ssh abc1234@i5.nyu.edu
TouchTerm
.ConnectBot
.To edit a file on i5.nyu.edu, use one of the Unix editors:
/usr/local/bin/pico
is the simplest./bin/vi
is the most widely used.
(I use
vi
.)/bin/vim -g
is an improved
vi
with a graphical user interface.
Search for the
vim
instructions in
Handout 3
of my
Unix course./bin/emacs
has the most features.
i5.nyu.edu has three pairs of C and C++ compilers.
The ones in teh first column are broken;
use the ones in the second column.
To get the
C++0x
extensions,
give the command line argument
-std=c++0x
/opt/gcc453/bin/g++
.
GNU version 4.5.3 | GNU version 4.5.2 | GNU version 3.4.6 | |
---|---|---|---|
C | /opt/gcc453/bin/gcc |
/usr/bin/gcc |
/usr/local/bin/gcc |
C++ | /opt/gcc453/bin/g++ |
/usr/bin/g++ |
/usr/local/bin/g++ |
On Linux,
install the packages for
gcc
and
gcc-c++
if you don’t already have them.
cd pwd
cp ~mm64/public_html/INFO1-CE9264/src/hello.C hello.C ls -l hello.C
/opt/gcc453/bin/g++ hello.C ls -l a.out
./a.out Hello, world! This is an error message.
echo $? 0
./a.out > output.txt 2> errors.txt ls -l output.txt errors.txt
./a.out > both.txt 2>&1 ls -l output.txt errors.txt
cd pwd
cp ~mm64/public_html/book/src/sources/fg.h fg.h cp ~mm64/public_html/book/src/sources/fg.C fg.C cp ~mm64/public_html/book/src/sources/main.C main.C ls -l fg.h fg.C main.C
/opt/gcc453/bin/g++ main.C fg.C ls -l a.out
./a.out
The
-I.
option ensures that the compiler will include
~mm64/book/src/term/term.h
,
not some other
term.h
file.
The
-D
option defines the macro
UNIX
,
which is used in the
term.c
file.
cd pwd
cp ~mm64/public_html/book/src/term/term.h term.h cp ~mm64/public_html/book/src/term/term.c term.c cp ~mm64/public_html/book/src/term/main.C main.C ls -l term.h term.c main.C
/opt/gcc453/bin/gcc -I. -DUNIX= -c term.c ls -l term.o
/opt/gcc453/bin/g++ -I. main.C term.o -lcurses ls a.out
./a.out