Aide memoire to using the unix C++ environment for 3C59



 
 
 


Use of the Unix environement

Log on to WTS

To connect to socrates/solaris you will use an Exceed session. There should be a session file set up to make a terminal window on the solaris system.  Exceed is accessed from the start->programs menu on windows.
 

As soon as you are into solaris type

    tcsh

this will put you in a better shell where useful features work (the default shell is csh which is not very useful)

Some simple unix commands are
 

To use the emacs editor type

    emacs &

this version of emacs is fairly intuitive to use, so play around with the menus.
 


Preparation for exercises

These instructions need to be followed once at the beginning of the course.
 

Directory structure

Make a directory structure (using mkdir) starting from either your top directory or anywhere else you want if you are familiar with unix.

It should look like this:

......../oocourse/util/
                                 /misc
                 /DotProduct/
                 /BankAccount/
                 /ComptonAnalysis/
                 /ComptonMC/
                 /ParticleGeneration/
                 /Complex/

Whenever you perform an exercise you will be told which of these directories to use
 
 

Environment

Copy the file build.sh (available from the course web pages) into the oocourse directory

Change directory to your home directory with

          cd ~

Then type the following:

          chmod u+xw .cshrc
(dont miss out the . in .cshrc)

Start emacs and edit the file

    ~/.cshrc

Add the following line at the end of it:

    alias build  '~/oocourse/build.sh'

or wherever the path to your oocourse directory is
 
 


Building executable programs using emacs and the command line

We will hopefully use the Workshop environment which ISD have set up. However this is new and there may be some teething troubles. As a fall back (and in any case for the early exercises) we can also use a much simpler procedure from emacs or from a command line.

As example suppose we want to write , build and run a file called test.cpp

  1. Edit your test.cpp file in emacs and save it .
  2. Go to the command line and move into the directory you are doing this exercise (using cd  ).
  3. Type :  build test

  4. Note: you do not type the .cpp extention (you will get an error message if you do)
    This should compile your test.cpp file, and if successful make an executable called test.exe
  5. To run test.exe all you need to do is type on the command line:    test.exe
You can also do the same thing from within emacs. If you do then you will have the added feature that it will enable you to step through errors easily.
  1. Edit your test.cpp file in emacs and save it .
  2. From the tools menu select compile
  3. This will ask you for a command at the bottom of the page. You delete whats there and instead enter build test
  4. Then hit CR and test.cpp will be comliped
  5. If there are errors they will be displayed on a split screen.  The good bit is that if you now highlight an error and click the RH mouse button on it, then the line with the error will be shown on the top screen.
  6. When you fix an error and want to re-compile then just repeat the procedure
This should be enough to get you going with simple exercises.
 
 

Building executable programs using Workshop

These instructions to be added later