- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
![](/skins/images/BC9A7A3465121B56B278007F4EE8899F/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page