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

ifort+error 6413: This global name is invalid in this context

hamid_mosaddeghi
Beginner
3,863 Views
Hello Dears

I need minor question, I have dipole.f code and need to compile but after compile I get this error:

[hamid@localhost Desktop]$ ifort dipole.f
dipole.f(25): error #6406: Conflicting attributes or multiple declaration of name. [DIPOLE]
real*8 dipole
-------------^
dipole.f(128): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(1,i)=0.d0
----------^
dipole.f(129): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(2,i)=0.d0
----------^
dipole.f(130): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(3,i)=0.d0
----------^
dipole.f(155): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(1,j)=chge(i)*(xxx(i)-cmass(1,j))+dipole(1,j)
------------^
dipole.f(155): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(1,j)=chge(i)*(xxx(i)-cmass(1,j))+dipole(1,j)
----------------------------------------------------^
dipole.f(156): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(2,j)=chge(i)*(yyy(i)-cmass(2,j))+dipole(2,j)
------------^
dipole.f(156): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(2,j)=chge(i)*(yyy(i)-cmass(2,j))+dipole(2,j)
----------------------------------------------------^
dipole.f(157): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(3,j)=chge(i)*(zzz(i)-cmass(3,j))+dipole(3,j)
------------^
dipole.f(157): error #6413: This global name is invalid in this context. [DIPOLE]
dipole(3,j)=chge(i)*(zzz(i)-cmass(3,j))+dipole(3,j)
----------------------------------------------------^
dipole.f(164): error #6413: This global name is invalid in this context. [DIPOLE]
write(6,'(1p,10e12.4)')time,dipole
------------------------------------^
compilation aborted for dipole.f (code 1

how fix it?

I insert this line:

real*8 dipole ------> but get error again



Thanks
0 Kudos
1 Solution
John4
Valued Contributor I
3,863 Views

You cannot use the same name (i.e., dipole) for both the main unit and as a variable within that unit. Changing the first line to "program main" should solve that issue

There will still be some variables that should be arrays but are implicit scalars ---like vxx, vyy, vzz, etc.

View solution in original post

0 Kudos
1 Reply
John4
Valued Contributor I
3,864 Views

You cannot use the same name (i.e., dipole) for both the main unit and as a variable within that unit. Changing the first line to "program main" should solve that issue

There will still be some variables that should be arrays but are implicit scalars ---like vxx, vyy, vzz, etc.

0 Kudos
Reply