# Issue when compiling .f90 with a module

**URL:** <https://fortran-lang.discourse.group/t/issue-when-compiling-f90-with-a-module/2393>\
**Category:** Uncategorized\
**Created:** [December 12, 2021, 3:15pm UTC](https://fortran-lang.discourse.group/t/issue-when-compiling-f90-with-a-module/2393 "2021-12-12T15:15:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garynewport](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@garynewport](https://fortran-lang.discourse.group/u/garynewport)\
**Post date:** [December 12, 2021, 3:15pm UTC](https://fortran-lang.discourse.group/t/issue-when-compiling-f90-with-a-module/2393/1 "2021-12-12T15:15:00Z")

</div>

In my shift from `.f` to `.f90` I am moving the include references to modules.

I am doing so within a small step but keep getting the same error when I try to compile the system.

Basically, I have a file called `modules.f90`, which contains a series of modules incuding this…

```auto
module dummy_routines

	contains

		subroutine record_time(sf)

			<RECORDS START AND END TIME, THEN CALCULATES THE EXECUTION TIME>
			
		end subroutine
	
end module

```

I can compile this and I get a list of all the modules contained within the `modules.f90`, including one called `dummy_routines.mod`.

In the main code requiring this module I have this as the first 3 lines…

```auto
        use stellar_values, only: xm_sun, yr, grav
        use dummy_routines
        implicit none

```

stellar\_values is another of the modules and this generates no error.

The error is…

```auto
C:\Users\garyn\OneDrive\stelcor>gfortran -O dummymain.o stelcor.o -o dummymain
c:/users/garyn/gcc/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: dummymain.o:dummymain.f90:(.text+0x124): undefined reference to `__dummy_routines_MOD_record_time'
c:/users/garyn/gcc/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: dummymain.o:dummymain.f90:(.text+0x597): undefined reference to `__dummy_routines_MOD_record_time'
collect2.exe: error: ld returned 1 exit status

```

I do note that I do not have this defines as `main`; could this be the issue?

---

<div class="post-metadata">

**Author:** ![garynewport](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@garynewport](https://fortran-lang.discourse.group/u/garynewport)\
**Post date:** [December 12, 2021, 9:58pm UTC](https://fortran-lang.discourse.group/t/issue-when-compiling-f90-with-a-module/2393/3 "2021-12-12T21:58:34Z")

</div>

Thank you; that makes total sense (now). 🙂
