How to compile

 
 
 

******Please Note******

(7-February-1999)-If you are having problems compiling or running a program try adding the next two lines to you .tcshrc file.
setenv LD_LIBRARY_PATH /usr/local/gnu/lib
set path = ($path ./)

Paths need to use a compiler:

The following are that paths that you will need in your PATH variable to be able to access a compiler:

For cc Compiler:

/opt/SUNWspro/bin/cc

For CC Compiler:

/opt/SUNWspro/bin/CC

For gcc Compiler:

/usr/local/gnu/bin/gcc

For g++ Compiler:

/usr/local/gnu/bin/g++

For pc Compiler:

/opt/SUNWspro/bin/pc

For f77 Compiler:

/opt/SUNWspro/bin/f77

For f90 Compiler:

/opt/SUNWspro/bin/f90
Compiling a Program

To compile a program you use a compiler. Here is a list of compilers available on our system:

The simplest way to compile a program is to type:
compiler fname
where compiler is the name of the compiler and fname is the name of the file that contains your program. Hence to compile a C program you would type:
gcc program1.c
Doing so will create an executable called a.out. To run the program you would just type a.out

To compile a bunch of files called fname1, fname2, fname3 you would type:

compiler fname1 fname2 fname3
To write the executable to another file besides a.out you use the "-o" option of the compiler, for example:
compiler -o outfile fname1
will create an executable called outfile.
  • Example of a Makefile.


  • Department of ECE
    University of Illinois at Chicago
    ©Copyright Feb. 2002