Include File in Fortran in VisualStudio 2013

1.1k views Asked by At

My Problem is that I cannot include Files in VisualStudio 2013.

I can do this program and it works as it should:

Console5.f90 without include:

program Console5
implicit none
! Variables    
integer, parameter :: IDC_3D                          = 11
integer, parameter :: IDC_Contour                     = 22
integer, parameter :: IDC_TimeHist                    = 33
integer, parameter :: IDC_ContLev                     = 44

! Body of Console5
print *, 'Hello World'
print *, IDC_3D
print *, IDC_Contour  
end program Console5

but when I put the variables in another file Ami.fd and include it into "Console5" I get the Error #5102: Cannot open include file Ami.fd

Ami.fd:

  integer, parameter :: IDC_3D                          = 111
  integer, parameter :: IDC_Contour                     = 222
  integer, parameter :: IDC_TimeHist                    = 333
  integer, parameter :: IDC_ContLev                     = 444

Console5.f90 with include:

program Console5
implicit none    
include 'Ami.fd'
! Body of Console5
print *, 'Hello World'
print *, IDC_3D
print *, IDC_Contour   
end program Console5

Does anybody know why?

1

There are 1 answers

0
Steve Lionel On

By default, the compiler will look for include files in the same directory as the source. Make sure that ami.fd is in that directory.