2011-12-07 4 views
2

新しいPhortran 7をPTPの一部としてインストールしました。モジュールの依存関係をサポートするEclipse Phortranで管理ビルドを作成するにはどうすればいいですか?

多くのモジュールを必要とするOOPアプローチを使用してコードを開発したい 管理されたビルドシステムが.f90ファイルの依存関係を理解し​​ていないことがわかりました。

私は今この問題を1日中取り組んでいました。私は "偽" プロジェクトを使用して私の問題を説明します

マイプロジェクト持つ2つのファイル

main.f90の、module1.f90

main.f90の:

program main 
    use module1 
    implicit none 
    ..... 
    code... 
    ..... 
end program main 

module1.f90:

module module1 
    implicit none 
    contains 
    ..... 
    code... 
    ..... 
end module module1 

このコードをIDEで管理されたmakeおよびbuildコマンドを使用してコンパイルすると、 e。次のエラー:

F90_SRCS += \ 
../main.f90 \ 
../module1.f90 

OBJS += \ 
./main.o \ 
./module1.o 

私はこれを確認しなかったし、私はプロジェクトをコンパイルする場合:

Fatal Error: Can't open module file 'module1.mod' for reading at (1): No such file or directory 
make: *** [main.o] Error 1 

メイクファイルがアルファベット順サブディレクトリのファイルから取得

に行くように思えますmain.f90より前のmodul1.f90の順番はすべて素晴らしいです。

しかし、私はIDEが自動的にこの問題を処理できるという印象を受けました.FortranのUSEキーワードは、IDEにファイルのリンク順序を教えなければなりません。

誰かが私にこれを手伝ってもらえますか?マネージドメイクが依存関係を理解し​​ていることを他のスレッドで読んでいます。

ありがとうございました。

答えて

0

私は、メイクファイルプロセッサに依存関係を見いだそうとしました。 (並列アプリケーション開発者のためのEclipseでテスト版:ジュノリリースIDビルド:20120614から1722)を

  1. Set Module and Include Paths(この数字が挙げられる)

If your source code contains INCLUDE lines or USE lines referencing modules in other files, Photran needs to know where to look in order to find these. It will not figure this out automatically. For each project in which you plan to use refactoring support,

  1. Right-click on your project's folder in the Fortran Projects view
  2. Click on Properties
  3. Expand Fortran General in the list on the left, and click on Analysis/Refactoring
  4. List the folders in which Photran should search for INCLUDE files and modules when refactoring. They will be searched in order from the first folder listed to the last.Subfolders are not searched automatically; you must include them explicitly.
  5. Click OK

。 2.Eclipse IDEで、プロジェクトフォルダを右クリックし、 - >リファクタ - >サブプログラム - >呼び出しツリーをクリックします。あなたのモジュールのすべての依存関係を表示するはずです。

あなたのモジュールの順序に注意する必要があります:それは(コードhereから変更)

program test 
! Option #1: blanket "use constants" 
! use constants 
! Option #2: Specify EACH variable you wish to use. 
    use constants, only : PI,E,answer,earthRadiusInMeters 
    use constants2, only : PI2,E2,answer2,earthRadiusInMeters2 
    implicit none 

    write(6,*) "Hello world. Here are some constants:" 
    write(6,*) PI, E, answer, earthRadiusInMeters 
    write(6,*) PI2, E2, answer2, earthRadiusInMeters2 
end program test 

で実行されますが、あなたが変更した場合、モジュールと

module constants 
    implicit none 
    real, parameter :: PI=3.14 
    real, parameter :: E=2.71828183 
    integer, parameter :: answer=42 
    real, parameter :: earthRadiusInMeters=6.38e6 
end module constants 
module constants2 
    implicit none 
    real, parameter :: PI2=3.14 
    real, parameter :: E2=2.71828183 
    integer, parameter :: answer2=42 
    real, parameter :: earthRadiusInMeters2=6.38e6 
end module constants2 

use constants, only : PI,E,answer,earthRadiusInMeters 
    use constants2, only : PI2,E2,answer2,earthRadiusInMeters2 
    implicit none 
この

use constants2, only : PI2,E2,answer2,earthRadiusInMeters2 
    use constants, only : PI,E,answer,earthRadiusInMeters 
    implicit none 

ため

あなたは同じエラーを取得します。

大きなプログラムの場合は、manual makefile optionを使用しました。しかし、私はインテルのデバッガidbを使用しました。同じメイクファイルのPhotranのデバッガでブレークポイントを設定していないからです。

最高の運が。

関連する問題