Error: This USE statement is not positioned correctly within the scoping unit.

Error: This USE statement is not positioned correctly within the scoping unit.

I keep getting this error, and I have no idea why. The program is in a very standard structure:

      PROGRAM SIMILAR

include 'mkl.fi'
include 'mkl_lapack.fi'
include 'mkl_blas.fi'
use inoutch_module
use filePathModule
use globalDataModule
use solution_control
use glb_mesh
use subdomains
use NumericalIntgTableModule
c
implicit none
.....rest of code
END PROGRAM SIMILAR

and here's an example of the module:

module inoutch_module
save
c integer ichinp,ichout,ichmtx,ichstr,ichsta,ichwrl,ichplt,ichbdf
integer :: ich
integer, parameter :: iin=5
integer, parameter :: iout=6
integer, parameter :: ichinp=7
integer, parameter :: ichout=8
integer, parameter :: ichmtx=12
c integer, parameter :: ichstr=16
integer, parameter :: ichplt=18
integer, parameter :: ichsta=20
c integer, parameter :: ichwrl=22
integer, parameter :: ichbdf=26
integer, parameter :: ichtfd=27
integer, parameter :: ichmatlab=28
end module inoutch_module
So what's going on?? the error i get is this:

fortcom: Error: Main.f, line 20: This USE statement is not positioned correctly within the scoping unit.
use inoutch_module
------^


4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

"USE YourModule" must preceed local variable declarations. Your include file (at least one of your include files) is declaring at least one variable.

Place your USE to preceed the include statements.

Jim Dempsey

USE also must precede any IMPLICIT statements. Best is to have them come directly after the SUBROUTINE or FUNCTION statement.

Retired 12/31/2016

Thanks!

Leave a Comment

Please sign in to add a comment. Not a member? Join today