Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29278 讨论

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

arthur_amarra
初学者
4,300 次查看
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
------^


0 项奖励
3 回复数
jimdempseyatthecove
名誉分销商 III
4,300 次查看

"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

0 项奖励
Steven_L_Intel1
4,300 次查看
USE also must precede any IMPLICIT statements. Best is to have them come directly after the SUBROUTINE or FUNCTION statement.
0 项奖励
arthur_amarra
初学者
4,300 次查看
Thanks!
0 项奖励
回复