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.

multiple definition of

Jian_G_
Beginner
1,244 Views

I'm using Intel Fortran Compiler for Linux to recompile a program originally compiled by Compaq Visual Fortran.

A linking problem occurs.

------------------------------Detail-----------------------------------

1.o: In function `_unnamed_data$_'1.for:(.text+0x4080): multiple definition of `_unnamed_data$_'
5.o:5.for:(.text+0xe690): first defined here

2.o: In function `_unnamed_data$_':2.for:(.text+0x0): multiple definition of `_unnamed_data$_'
5.o:5.for:(.text+0xe690): first defined here

3.o: In function `_unnamed_data$_':3.for:(.text+0x43f0): multiple definition of `_unnamed_data$_'
5.o:5.for:(.text+0xe690): first defined here

4.o: In function `_unnamed_data$_':4.for:(.text+0x0): multiple definition of `_unnamed_data$_'
5.o:5.for:(.text+0xe690): first defined here

-----------------------------End---------------------------------------

Compiling with CVF passed. The program includes 31 *.for files. using command "ifort -c *.for"to compile every source file and get 31 *.o files.

But a problem occured when I am linking the *.o files to get "myapp".

I QUITE sure the program is OK. I waiting for your help. Thanks!

0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,244 Views

Do you INCLUDE a COMMON declaration into each source along with DATA initializations for variables in that COMMON? That is not allowed in Fortran, but some platforms let you get away with it. The correct solution is to move the initializations to a BLOCK DATA subprogram that appears only once in the program.

Can you attach sources of a test case showing the problem?

0 Kudos
Reply