I am new to Fortran. I am working on a research project in which I am using an open source project that has several files distributed in several folders. I found the dependency of each program, but could not figure out how to compile them.
I have the source code distributed in three folders. a) modules b) interfaces c) subroutines
I would like to run a program called "Main.f90" in the subprograms folder, this program has a source code dependency on modules and interface folders.
I use eclipse for folder structure and makefile for compilation.
Any help with this is appreciated.
UPDATE: I followed the answer posted by @MBR and @Stefan, for some reason VPATH could not find the programs in the source code, so I explicitly gave the path to this source folder in my Makefile. below is my make script file.
.PHONY: Mopac_exe clean
I compiled all the modules and put them in the Modules directory of the root folder. The whole compilation is going well. I get an error while creating an executable file. I get the following error.
gfortran mopac.o *.o -O2 -g -o bin/Mopac_exe -I Modules/ mopac.o: In function `main': mopac.F90:(.text+0x27c1): multiple definition of `main' mopac.o:mopac.F90:(.text+0x27c1): first defined here getdat.o: In function `getdat_': getdat.F90:(.text+0x22): undefined reference to `iargc_' getdat.F90:(.text+0xf2): undefined reference to `getarg_' symr.o: In function `symr_': symr.F90:(.text+0xd3f): undefined reference to `symp_' writmo.o: In function `writmo_': writmo.F90:(.text+0x20c2): undefined reference to `volume_' collect2: error: ld returned 1 exit status make: *** [Mopac_exe] Error 1
`iargc_ 'is used in the' getdat file, and iargc is already compiled. why does an error occur when creating an executable saying an undefined link? What am I missing?
source share