Software Archive
Read-only legacy content
17060 Discussions

Using Derived Types in Common Blocks

bbeyer
Novice
1,319 Views
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.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,319 Views
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
0 Kudos
Reply