2011-12-07 1 views
2

PTP의 일부로 새로운 Phortran 7을 설치했습니다.모듈 종속성을 지원하는 Eclipse Phortran에서 관리 빌드를 작성하는 방법은 무엇입니까?

많은 모듈이 있어야하는 OOP 방식을 사용하여 코드를 개발하고 싶습니다. 관리 빌드 시스템이 .f90 파일의 종속성을 이해하지 못하는 것으로 나타났습니다.

나는 하루 동안이 문제를 해결하기 위해 노력하고있었습니다. 나는 "가짜"프로젝트를 사용하여 내 문제를 설명합니다

내 프로젝트가 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 명령을 사용하여이 코드를 컴파일하면 전자 다음 오류 : 나는에서 프로젝트를 컴파일하는 경우

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에 파일을 연결하는 순서를 알려야합니다.

다른 사람이 나를 도와 줄 수 있습니까? 관리되는 make가 종속성을 이해해야한다는 것을 다른 스레드에서 읽었습니다.

대단히 감사합니다.

답변

0

메이크 파일 프로세서에 종속성을 찾기 위해 약간의 임시 해결책을 제시했습니다.

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

  1. Set Module and Include Paths가 (이 숫자는 인용) (. 병렬 응용 프로그램 개발자 버전 이클립스에서 테스트 :. 20120614-1722 : 주노 출시 ID를 빌드). Eclipse IDE에서 프로젝트 폴더를 마우스 오른쪽 버튼으로 클릭 한 다음 리팩토링 -> 서브 프로그램 -> 호출 트리를 클릭합니다. 모듈에있는 모든 의존성을 보여 주어야합니다.

    당신은 당신의 모듈의 순서에주의해야한다 : 변경할 경우

    모듈

    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 
    

    이 (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 
    

    과 실행에 있지만,

    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 
    

    에 대한 17,451,515,

    는 동일한 오류가 발생합니다.

    더 큰 프로그램의 경우 manual makefile option을 사용했습니다. 하지만 디버깅을 위해 동일한 메이크 파일 Photran의 디버거가 중단 점을 넣지 않았기 때문에 Intel 디버거 idb을 사용했습니다.

    최고의 행운의 친구.