Setup and configure an open source Fortran development environment on Windows

來源:互聯網
上載者:User

標籤:des   style   blog   http   java   color   

We must have 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 compiler 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 are so convenient that we almost have no time cost on mastering them. However, they may lead you to the following traps:

  1. The operations, like “creating a project”, “pressing a button to compile and debug”, will hide the basic and important knowledge about how to transform the source code into a final executable program and deprive you of the valuable chance to learn more advanced topics of knowledge.

  2. For a complex project structure containing many test cases, libraries and programs to be compiled and debugged, the convenience and “advantage” of 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 computing. Therefore, transplant of the project to Linux or UNIX-like systems may 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 is difficult to find) and neither do many other people, it is almost impossible to publish and distribute the code to the public.

The setup of an open source development environment on Windows is quite easy as long as you have a basic knowledge or a little experience about programming under Linux environment. At present, to my personal knowledge, two solutions are 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 an automation toolset for managing projects; Emacs is a super text editor which is not an IDE but much powerful than any other IDEs; Eclipse is an open source IDE belonging to the Java world and there is a plugin called Photran developed by UIUC which brings Fortran programming in Eclipse into reality.

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

Installation of gcc and gdb

The simplest way to install gcc and gdb on Windows is to have Cygwin on your system. There are also MingGW and MSYS, but they will not be introduced here. Cygwin is a Linux-like environment on Windows, in which a dynamic library cygwin1.dll serves as an interface between Linux programs and Windows system API. It is due to this library that source code of Linux software can be recompiled on Windows. Therefore, with Cygwin we can still keep our efficient and powerful working styles as those on Linux. Cygwin installer is merely a single setup.exe file which can be downloaded from here. All the required software packages in Cygwin are downloaded from mirror sites located all over the world. Suggested mirrors in China are 163 and Sohu, which have 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 are not sure and want to have a complete Linux environment, you can install all 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 has already included cdt and Photran packages along with some functionalities oriented for developing parallel 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 debugger will be 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 is ready, let’s start coding!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.