Setup and configure an open source Fortran development environment on Windows

Source: Internet
Author: User

We must has already been familiar with proprietary Fortran programming environments, for example,

    • Compaq Visual Fortran IDE (which is actually a combination of Microsoft ' s Visual Studio 6 IDE and Compaq ' s Fortran compile R along with commercial numerical libraries like IMSL by Visual Numerics and libraries for developing Windows GUI programs .

    • Visual Studio 2005 or above and integrated Intel Fortran compiler.

Of course, these tools is so convenient that we almost has no time cost on mastering them. However, they may leads you to the following traps:

  1. The operations, like "Creating a Project", "pressing a button to compile and debug", would hide the basic and important kno Wledge about what to transform the source code in a final executable program and deprive you of the valuable chance to Le ARN more advanced topics of knowledge.

  2. For a complex project structure containing many test cases, libraries and programs to be compiled and debugged, the Conven Ience and "advantage" of the IDE Fade away and furthermore, IDE would probably be incapable of such a formidable situation.

  3. Windows operating system is still not professional and resource-saving enough for a serious scientific high performance Co Mputing. Therefore, transplant of the project to Linux or unix-like systems could be requisite. However, your MS Studio projects can ' t be directly and easily compiled on any other platforms except Windows.

  4. Because we haven ' t bought all those commercial tools (even a free Fortran compiler are difficult to find) and neither do Ma NY Other people, it's almost impossible to publish and distribute the code to the public.

the setup of an open source development environment on Windows are quite easy as long as you have a basi C knowledge or a little experience about programming under Linux environment. At present, to my personal knowledge, the solutions is Available:gcc+gdb+autotools+emacs and Gcc+gdb+eclispe, where GCC is an assembly of several compilers including C, C + +, Fortran, Java, object-c, Ada, etc.; GDB is a command line driven debugger; Autotools is a automation toolset for managing projects; Emacs is a super text editor which are not the IDE but much powerful than any other IDEs; Eclipse is an open source IDE belonging to the Java world and there are a plugin called Photran developed by UIUC which BRI NGS Fortran programming in Eclipse into reality.

The first solution mentioned above is a fully text-based program developing environment, although isn't so illustrative but Much more powerful and superior than any other IDE. The latter is based on Eclipse which was suitable for those be used to MS Visual Studio. Next, basic procedures of setup and configure the second solution would be introduced.

Installation of GCC and GDB

the simplest to install GCC and gdb on Windows are to has Cygwin on your System. There is also MINGGW and MSYS, but they'll is not being introduced here. Cygwin is a linux-like environment on Windows, in which a dynamic library cygwin1.dll serves as an interf Ace between Linux programs and Windows system API. It is the due to this library, the source code of Linux software can be recompiled on Windows. Therefore, with Cygwin we can still keep we efficient and powerful working styles as those on Linux. Cygwin installer is merely a single setup.exe file which can downloaded from here. All of the required software packages in Cygwin is downloaded from mirror sites located all through the world. Suggested mirrors in China is 163 and Sohu, which has fast speed and no oversea cost (and thanks to their contributions To the Open source world):

http://mirrors.163. comhttp://mirrors.sohu.com

Add any one of them to the download site list in Cygwin and proceed:

Search and install these packages:

    • Gcc4

    • Gcc4-core

    • Gcc4-fortran

    • gcc4-g++

    • Gdb

    • Make

    • Automake & automake1.11

    • Autoconf & autoconf2.5

If you aren't sure and want to having a complete Linux environment, you can install all of the packages but it takes time. After install of the above packages, add Cygwin related paths to environment variable Path:

C:\cygwin\bin; C:\cygwin\usr\bin; C:\cygwin\usr\local\bin; C:\cygwin\lib; C:\cygwin\usr\lib

Installation of Eclipse

Eclipse is a software written in Java, therefore you should install JRE (Java Runtime Library) from the official site. Then, download the Eclipse IDE for Parallel application developers, extract and run. This version have already included CDT and Photran packages along with some functionalities oriented for developing Paralle L programs.

Create a Fortran Project

This procedure needs no detailed explanation. If you've already added Cygwin related paths to the environment variable Path, the GCC compiler and the GDB debug Ger'll is detected by Eclipse. If you want to create a Fortran exe program, just select the project type executable (Gnu Fortran on Windows) as Following:

Now, everything are ready, let's start coding!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.