Bing Dong, Ph.D.Candidate
Center for Building Performance and Diganostics
Department of Architecture

Carnegie Mellon University
College of Fine Arts

 

 PROFILE RESEARCH COURSES INFORMATION PROJECTS PROGRAMMING CONTACT

 

  PROGRAMMING

PROFILE

COURSES INFORMATION

PROJECTS

CONTACT

 

How to run Fortran Project in Eclipse

CopyRight@Bing Dong, 2008

Created Date: 01/18/2008

If you are green hand without any experience in Cygwin, you may follow the steps below:
1. Set-up build tools:

* Install Cygwin to directory C:\cygwin
* Download from: http://sources.redhat.com/cygwin/
* When you install, be sure to include "make", "gcc","gcc++" in your option under "Develope".

2. Set-up the build directory:

* Start a Cygwin session and run the following command:

mkdir -p /src/G95/gcc-4.0.3/g95

3. Get and build GCC:

* Within the Cygwin session run the following commands:

# download GCC via FTP:

ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.0.3/gcc-core-4.0.3.tar.gz

*Upack it into /src/G95/gcc-4.0.3/g95
*In your Cygwin session, you are now under the root.
*Make sure you are not in the folder: /src/G95/gcc-4.0.3/g95/gcc-4.0.3

# configure GCC for G95
cd /src/G95/gcc-4.0.3/g95

./gcc-4.0.3/configure --enable-languages=c \ --disable-nls

if you see error below:
Error:Running system checks ...
checking host system type... i686-pc-cygwin
checking for gcc... no
checking for cc... no
configure: error: no acceptable cc found in $PATH

Solution: Run setup.exe again and choose gcc from options

4. *Build GCC for G95

make

* it will run nearly half an hour to build everything up.

5. Configure the g95 source distribution:

* Download the g95 source and unpack it within C:\cygwin\src\G95
* Within the Cygwin session run the following commands:

cd /src/G95/g95-0.91
./configure --prefix=/usr/local --with-gcc-dir=/src/G95/gcc-4.0.3

* Continue with the g95 compilation instructions

6. Try to run hello.f90 under cygwin.
*Crate a file called hello.f90

program hello
print *, "Hello World"
stop
end program hello

*run it
g95 hello.f90

You will see a.exe under the folder /src/G95/gcc-4.0.3/g95
*run it under Cygwin
./a.exe
*You will see on the screen
Hello world

7. g95 tutorial

You can find g95 commands and tutorials here:
http://www.g95.org/docs.html#rung95

8. Configure built path

c:\cygwin\bin and c:\cygwin\usr\bin should be in your system path,
and the g95 libraries need to be copied into /usr/lib
Restart the computer.

9. Run it in Eclipse
* install Eclispe: download from www.eclips.org and unpack it.
* going to Help->software update->find update... search for latest CDT
* Download it and update.
* Go to http://www.eclipse.org/photran/documentation.php to download photran.
* Copy features and plugins from photran to Eclips

10. Supplement documentation

From this step you can follow exactly the same steps here:
http://www.eclipse.org/photran/documentation.php