Instructions for Compiling a C program with the gcc Complier

Download simple.c, a simple test program, by right-clicking here and selecting Save Link As. Save this file on your desktop.

Start Cygwin which provides a Linux-like environment on Windoze. Cygwin and gcc are free thanks to the open source movement ... yay, open source!.

Change directory to your desktop using the cd command as follows. Note that my username is rb88. You need to replace this with your username.

Compile simple.c using the gcc compiler and create the executable simple.exe.

Run simple.exe.

Note that "./" needs to precede the executable name to indicate that it is in the current folder or directory. If the program runs normally, you'll get the output "This is a native C program" written to the cygwin window.

Instructions for Compiling a C program with Visual Studio

See this page.

Instructions for Compiling a FORTRAN program with the gfortran Complier

Download pi.f90, a simple test program, by right-clicking here and selecting Save Link As. Save this file on your desktop.

Start Cygwin which provides a Linux-like environment on Windoze. Cygwin and gfortran are free thanks to the open source movement ... yay, open source!.

Change directory to your desktop using the cd command as follows. Note that my username is rb88. You need to replace this with your username.

Compile pi.f90 using the gfortran compiler and create the executable pi.exe.

Run pi.exe.

Note that "./" needs to precede the executable name to indicate that it is in the current folder or directory. If the program runs normally, you'll get the value of pi written to the cygwin window as above.

  • No labels