In order to compile C++ programs use this command:
g++ -O <path>source_code.c -o <path/>exec_code
In order to compile C programs use this command:
gcc -O <path> source_code -o <path/> exec_code
Example:
g++ -O cge1.cpp -o cge1
OR
g++ -O /home/john/csc5551/cge1.cpp -o
/home/john/csc5551/cge1
gfortran -O <path> source_code.f90 -o
<path> exec_code
Example:
gfortran -O fge1.f90 -o fge1
OR
gfortran -O /home/john/csc5551/fge1.f90 -o
/home/john/csc5551/fge1
-o
<file>: place the output into <file>. If this
option is
omitted, the compiler will create executable program named a.out in
working directory.
<path>: directory where the code is. It is optional.
-O: compile program with optimization
-Wall:
print out all warnings