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.
29281 Discussions

swanmain.f:(.text+0x0): multiple definition of `MAIN__'; /mnt/c/FYP/adcirc_v55.01/work/odir44/driver

LIN2
Beginner
1,146 Views

I encounter the problem like this:

ld: /mnt/c/FYP/adcirc_v55.01/work/odir44/swanmain.o: in function `MAIN__':
swanmain.f:(.text+0x0): multiple definition of `MAIN__'; /mnt/c/FYP/adcirc_v55.01/work/odir44/driver.o:driver.F:(.text+0x0): first defined here
make[1]: *** [makefile:605: padcswan] Error 1
make[1]: Leaving directory '/mnt/c/FYP/adcirc_v55.01/work'
make: *** [makefile:517: padcswan] Error 2

what should i do

0 Kudos
3 Replies
Arjen_Markus
Honored Contributor II
1,137 Views

A program can only have one MAIN program unit. In Fortran that is the program unit. Apparently your link statement includes two or more object files that are derived from a source file containing "program somename"'. You will have to check which one is the correct one. (Or perhaps one should be a subroutine)

0 Kudos
mecej4
Honored Contributor III
1,127 Views

The error messages from the linker make it quite clear that both swanmain.o and driver.o contain main program units. Only one of the two should be used. Which one? That is for you to determine, based on what the files contain and what you are attempting to build.

0 Kudos
Ron_Green
Moderator
1,113 Views

If your main program is C calling a Fortran library or routine, you'll need -nofor-main 

HERE for details

 

and read the Developer Guide and Reference, Mixed Language programming, compiling and linking.

0 Kudos
Reply