Photran的用法(转载自eclipse官网)
Getting Started with Managed Make
If your system has the GNU gfortran compiler installed, try this.
- File | New | Fortran Project
- Call it whatever
- Choose the Executable (Gnu Fortran) from the project type list 注:对于Ubuntu 8.10系统已经不再提供G77支持了,因此,编译器一定要选gfortran,即GNU Fortran
- Choose GCC Toolchain from the toolchain list (you may need to uncheck the "Show project types..." check box at the bottom of the window)
- Click Next
- Click on Advanced Settings
- Expand C/C++ Build in the list on the left, and click on Settings
- Click on the Binary Parsers tab. Check the appropriate parsers for your platform. If you are using Windows, check PE Windows Parser and/or Cygwin PE Parser; if you are using Linux, check Elf Parser; if you are using Mac, check Mach-O parser.
- Click on the Error Parsers tab. Check the error parser(s) for the Fortran compiler(s) you will use.
- Click OK
- Click Finish
- Click File | New | Source File
- Call it hello.f90; click Finish
- Type the standard "Hello, World" program, and click File | Save.
program hello
print *, "Hello World"
stop
end program hello
- Open the Console view, and make sure "make" ran OK and compiled your program
- In the Fortran Projects view, expand the Binaries entry, and click on your executable (e.g., "whatever - [x86le]") 这个设计很好很强大到让人摸不着头脑,因为用M$的V$已经用惯了。。。
- Run | Run As | Run Local C/C++ Application (yeah, I know, it should say "Fortran Application", but it doesn't)
- Choose GDB Debugger (Cygwin GDB Debugger if you're under Windows)
- Check the Console view, and make sure Hello World appeared.
Getting Started with Standard Make
To get started, try this. If you're under Windows, you need to be running Cygwin, 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 (to make things easier for yourself, at least).
- File | New | Fortran Project
- Call it whatever
- Choose Makefile Project from the project type list (it has a folder icon; do not expand it)
- Choose "-- Other Toolchain --" from the toolchain list <--li>Click Next
- Click on Advanced Settings
- Expand C/C++ Build in the list on the left, and click on Settings
- Click on the Binary Parsers tab. Check the appropriate parsers for your platform. If you are using Windows, check PE Windows Parser and/or Cygwin PE Parser; if you are using Linux, check Elf Parser; if you are using Mac, check Mach-O parser.
- Click on the Error Parsers tab. Check the error parser(s) for the Fortran compiler(s) you will use.
- Click OK
- Click Finish
- File | New | File
- Call it Makefile
- Click Finish
- We assume you're familiar with how to format a Makefile. Something like this will work for now. Remember to start the g95 line with a tab, not spaces. The -g switch instructs g95 to include debugging symbols in the generated executable so that it can be debugged later.
all:
g95 -g hello.f90
clean:
- File | New | Source File
- Call it hello.f90
- Click Finish
- Type the standard "Hello, World" program.
program hello
print *, "Hello World"
stop
end program hello
- Project | Clean; then click OK
- Open the Console view, and make sure "make" ran OK and compiled your program
- In the Fortran Projects view, expand the Binaries entry, and click on your executable (e.g., "whatever - [x86le]")
- Run | Run As | Run Local C/C++ Application (yeah, I know, it should say "Fortran Application", but it doesn't)
- Choose GDB Debugger (Cygwin GDB Debugger if you're under Windows)
- Check the Console view, and make sure Hello World appeared.