Using Derived Types in Common Blocks

Using Derived Types in Common Blocks

I am having problems using a derived data type as an object in a named common block. I placed the derived type and the common statement in an include file and tried to use the include file in three subroutine. The linker gives error 2005, followed by 1169 stating that the named block was already defined. Is there a way to do this? Thank you.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I'd bet a quarter that you have specified initial values for one or more COMMON variables in the INCLUDE file. The Fortran language does not allow a COMMON block to be initialized in multiple program units, and the Microsoft linker doesn't like it either!

Solution - take the initialization out of the INCLUDE. Add a BLOCK DATA subprogram which INCLUDEs the definition of the COMMON and then has the initialization in DATA statements.


Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today