- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Just upgraded to Composer XE 2011 and code that compiled in IVF 9 through 11 but not fails with the error message:
error #6897: An interface-block in a subprogram must not contain an interface-body for a procedure defined by that subprogram.
I cannot find any help on this error. The source file only contains a single interface block with several interface definitions and the compiler error is thrown for only some of the routine definitions.
- Balises:
- Intel® Fortran Compiler
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The Fortran language does not allow "interface to self" - you can't INCLUDE a file that declares the interface to a procedure you are also defining. There's not enough in your pseudocode to know which the problem is. For example, if <stuff> included an interface for sub0, that would be an error.
The usefulness of "interface to self" has been discussed extensively by the standards committee, but it never gained enough support to add and I think some issues were raised that blocked further work (I don't remember the details.)
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Later versions of the compiler do more thorough checking of code. Interfaces may become available through USE statements, so their presence is easy to overlook.
Please present example code that can be used to display the error message. Here is an example that produces an error message with the 13.1 compiler but not with the 11.1 compiler.
subroutine sub(a,b) implicit none integer, intent(in) :: a integer, intent(out) :: b interface subroutine sub(c,d) integer, intent(in) :: c,d end subroutine sub end interface b=f(a) return contains integer function f(d) integer, intent(in) :: d f=d*d return end function f end subroutine sub
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
See the psuedo-code below trying to explain the project:
program test use ifport use <MyLib1> use <MyLib2> include <stuff> include _interfaces.f90 call sub0(parameters) call sub1(parameters) end program test
in the source file _interfaces.f90:
interface subroutine sub0(parameters) include <stuff> ! same as in main, global parameters <I/O variable declarations> end subroutine sub0 subroutine sub1(parameters) use ifport, only: ... use <MyLib1> include <stuff> ! same as in main, global parameters <I/O variable declarations> end subroutine sub1 end interface
This is a much larger project and I trying to demonstrate the code structure.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The Fortran language does not allow "interface to self" - you can't INCLUDE a file that declares the interface to a procedure you are also defining. There's not enough in your pseudocode to know which the problem is. For example, if <stuff> included an interface for sub0, that would be an error.
The usefulness of "interface to self" has been discussed extensively by the standards committee, but it never gained enough support to add and I think some issues were raised that blocked further work (I don't remember the details.)
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
<stuff> would only contain data type info, constants, etc to quickly propagate code changes. No routines or interfaces would be defined in the <stuff> source file.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Then please show us a complete source file that demonstrates the error.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Resolved; the issue was essentially an 'interface-to-self' caused by including a file that defined the routine interface to the routine source file itself. It is a trivial error once you understand what the message is telling you.

- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable