Dear all,
I am trying to create a fortran program. I have already done this in Windows and using Visual Studio.
In linux I am using ifort (ifort (IFORT) 14.0.2 20140120).
I am very new to this. I appreciate your help. I will explain the procedure I am taking below.
I have my source code ( File1.f90, File2.f90, File3.f90 and main.f90) and then I have a folder full of external libraries (*.a and *.mod )
I have not written these libraries nor I have any idea which compiler was used to compile and create those libraries.
I try to first compile my files using the following:
File1.90 and File2.f90 are not using these external libraries while File3.90 is using these external libraries. At last main.f90 is using File3.90. In order to compile I have used the following commands:
ifort -c File1.f90
ifort -c File2.f90
ifort -c File3.f90 -I mylib&modulesDirectoryAddress
ifort -c main.f90 -I mylib&modulesDirectoryAddress
All files are compiled successfully but when I try to link them using the following command I ran in to error :
ifort File1.o File2.o File3.o main.o -I mylib&modulesDirectoryAddress
The error is this:
File3.f90 undefined reference to `m_get_mp_myFunction_'
myFunction is a function that I call inside File3.f90 from one of the external modules/libraries.
subroutine File3_internalFunction
use externalModule, only : myFunction
implicit none
!external
character(len=*), intent(in) :: fname
integer, intent(in) :: timeStep
character(len=32), intent(in):: vname
real, pointer :: varValue(:)
logical:: stopIfNotPresent
character(len=256) :: firstPartOfString
character(len=80) :: outpStr
varValue => myFunction(fname, vname, timeStep)
end subroutine
Could you please let me know what is the possible reason that I am getting the above error? Also do I need to have additional compile or link options that I am missing right now ? I am coming from Visual Studio and I am quite confused how to get the same exectuable here?
Also are there any system-dependent options that I will need to define?I am trying to get an executable for 64-bit Linux systems.
I would really appreciate your help.
Thank you very much in Advance for your help.
Kind Regards,
Heli