2016年6月5日日曜日

ラズパイにfortran95の環境を構築する

以前にWindows7にFortran77の環境構築をしたので、
今回はラズパイにFortran環境を構築していく
ただ、なんかFortran95になってしまったので、そこは悪しからず。。

 インストール
インストールのコマンドは超簡単!
# apt-getを最新に
$ sudo apt-get update

# Fortranをインストール
$ sudo apt-get install gfortran
これだけ!
一応バージョン確認
$ f95 --version
GNU Fortran (Debian 4.6.3-14+rpi1) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
ちゃんと入ってるっぽい

 実行してみる
とりあえずテスト用のプログラムファイルを作る
! sample.f
      character*12 str
      str='hello world!'
      write(*,*) str
      stop
      end
実行コマンド
# コンパイルは「f95 ファイル名」
$ f95 sample.f

#コンパイルができると、「a.out」ファイルができる
#これが実行コマンド
$ ./a.out
 hello world!

完成!!

0 件のコメント:

コメントを投稿