Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

unclear compile error

Boyd_G_1
Beginner
1,139 Views

When I compile (build) my fortran code, which compiled and ran some time ago on an IBM mainframe, I get the error:

#5507 there are multiple unnamed main program declarations in this file

 

and I don't know where to start to repair.  Help?

0 Kudos
3 Replies
mecej4
Honored Contributor III
1,139 Views

The source code probably got corrupted during the transfer from the mainframe. Typically, in fixed form Fortran, if the source contains tabs or if some characters got lost, you may have a source file in which, say, the second subroutine statement in the file starts before column 7. The rest of the subroutine is seen as a main program by the compiler and, if there was a main program already scanned, the compiler would give the error message that you saw.

We could be more specific if you can show the source code.

0 Kudos
Boyd_G_1
Beginner
1,139 Views

Thank you for your help.  I reviewed the file looking for any mis placed letter in col 6 - none found.  However, it turns out that I have multiple BLOCK DATA blocks - and naming them solved error.  I'm thinking the multiple BLOCK SATA's must have been interpreted as a MAIN.

 

So I'm moving forward!  Thank you!

0 Kudos
mecej4
Honored Contributor III
1,139 Views

Normally, it is at link time that multiple definitions of code symbols (subroutines, functions) and data symbols (named blocks) are detected and reported. The Intel compiler can see that there is something wrong when two blocks with the same name (or with no names) occur in the same source file. However, the messages that it gives can be confusing! The code

      program too_many_blocks
      implicit none
      integer a,b,c, p,q,r
      common /abc/a,b,c
      common /pqr/p,q,r

      write(*,*)a,b,c
      write(*,*)p,q,r
      end program

      block data bb!B_abc
      implicit none
      integer a,b,c
      common /abc/a,b,c
      data a,b,c/10,11,12/
      end

      block data bb!B_pqr
      implicit none
      integer p,q,r
      common /pqr/p,q,r
      data p,q,r/22,21,20/
      end

results in the message

blks.f(23): error #5507: There are multiple unnamed main program declarations in this file
      end
------^
compilation aborted for blks.f (code 1)

If I name both blocks as 'bb', the message becomes

blks.f(18): error #5508: Declaration of routine 'BB' conflicts with a previous declaration
      block data bb!B_pqr

If the two block data-s are placed in separate files, at link time we see

blk2.obj : error LNK2005: __UNNAMED_DATA$ already defined in blks.obj
blks.exe : fatal error LNK1169: one or more multiply defined symbols found

It should not be too hard for the compiler to differentiate between code symbols and data symbols.

0 Kudos
Reply