VECDEMO DESCRIPTION

  • vecdemo gzippped tar file.
    Download vecdemo.tar.gz (1411 byte gzipped)
  • 
    
    
    -----------------------------------------------------------------------
    	    vecdemo ( C++ demo )
    
    
    Note: Use the editor Nedit or nedit to edit your C++ files.
    In the editor options menu, select C++ formatting style
    to enable lots of handy C++ features.
    
    
    README file for vecdemo
    ------------------------
    
    
    A simple demonstration of a C++ program.
    
    
    
    Getting started. (% is my command prompt)
    
    	1. get the zipped tarfile
    		Go to my website: 
    			http://ws351.uncc.edu/courses/eegr4124/index.html
    		Click on  "Download vecdemo"
    
    	2. unzip the "tar" file:
    		% gunzip vecdemo.tar.gz
    
    	3. extract the tarfile
    		% tar -xvf vecdemo.tar
    
    
    You should have the following files in your directory:
    
    	Makefile     README       Vector.cc    Vector.h     
    	vecdemo.cc
    
    vecdemo.cc is the C++ source code for the main executable program.
    Vector.cc is a simple C++ class for vectors.
    Vector.h is the header file for Vector.cc.
    Makefile is used to automatically build the program.
    
    
    
    Building the program using make.
    --------------------------------
    
    You can compile and build the program by simply typing make at 
    the command line while you are in the directory.  When you do this
    you should see the following output at your computer screen:
    
    	% make
    	CC -g  -DMAIN -DSVR4 -c  Vector.cc -o Vector.o 
    	CC -g  -DMAIN -DSVR4 -c  vecdemo.cc -o vecdemo.o 
    	CC -g  -DMAIN -DSVR4  vecdemo.o Vector.o -o vecdemo  -lm
    
    After this you will find the executable file vecdemo in your 
    directory along with object files ( ".o" suffix).  You can run this
    file and see the output:
    
    	% vecdemo
    	hello: vecdemo here
    	loaded data
    	unnamed x=1 y=1
    	E x=2 y=3
    	F x=5 y=7
    	a=e
    	unnamed x=2 y=3
    	a=e.inner(f)
    	unnamed x=31 y=0
    	end: vecdemo 
    
    
    
    Building the program manually.
    ------------------------------
    
    You can build the program manually (entering each command, line by line).
    To do this, just run the three commands shown above:
    
    	% CC -g  -DMAIN -DSVR4 -c  Vector.cc -o Vector.o
    	% CC -g  -DMAIN -DSVR4 -c  vecdemo.cc -o vecdemo.o
    	% CC -g  -DMAIN -DSVR4  vecdemo.o Vector.o -o vecdemo  -lm
    
    The first command compiles the Vector class into an object file Vector.o.
    The second command compiled the main routine vecdemo.cc into an object
    file vecdemo.o.  The third command links the two object files and creates
    the executable file, vecdemo.
    
    
    About the Makefile.
    ------------------
    
    If you look at the Makefile, the line:
    
    	CCC = CC -g  -DMAIN -DSVR4
    
    sets the C++ compile command to "CC -g  -DMAIN -DSVR4".
    
    
    
    The 2 lines:
    
    	Vector.o:Vector.cc Vector.h
    		$(CCC) -c  Vector.cc -o Vector.o 
    
    say that if either file Vector.cc or Vector.h have more recent 
    dates/times than the file Vector.o, execute the second line.   In
    the second line $(CCC) is replaced by the earlier definition of CCC.
    The basic idea of these statements are to automatically update the
    appropriate files when the source files or headers are edited/changed.
    
    You may wish to try out the gnu compiler, too.  These lines are 
    commented out using pound signs at the beginning of the lines.
    
    Finally, if you type "make clean" the ".o" files and vecdemo are 
    deleted.  Occasionally this is needed in complex compilings to
    "start over".
    
    
    
    
    
    -----------------------------------------------------------------------