- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi Guys,
I am having a trouble using Fortran 90 with the following example:
I created two classes named pipe and connector
Module Class_pipe
use Class_connector
type Pipe
type(Connector),pointer :: conn
end type Pipe
End Module Class_pipe
Module Class_connector
use Class_pipe
type Connector
type(Pipe),pointer :: conn
end type Connector
End Module Class_connector
This piece of coding does not compile. I think it is because in the Module Class_pipe I "use" the Class_connector, while in the Module Class_connector I "use" the Class_pipe. Itis a cross reference situation. If I put the two type definition into one module, the code can compile, but I really hate to do so. Anyone can help me to resolve the problem?
Quan
- Balises:
- Intel® Fortran Compiler
Lien copié
1 Répondre
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You've answered your own question -- circularities of this sort are not allowed. Also, if your two UDTs need to reference each other, they are not logically distinct and belong in the same module anyway. Nothing wrong with putting all your types in a single module, and grouping your functions into separate modules which all USE the types module.

Répondre
Options du sujet
- 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