- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have 4 separate routines that have the same common block (called FRAME1) containing 5 integer variables.
Why would building result in the following message?
Linking...
v3scal.obj : error LNK2005: _FRAME1 already defined in v3grid.obj
Release/hdfviz.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
The common block "FRAME1" is identical in the 4 subroutines, so I don't see why the linker would have a problem with one of them.
I can get the program to link if I comment out the common block in v3scal.f, but then the program crashes with the following message when it tries to read an 11 MB HDF file.
forrtl: severe (157): Program Exception - access violation
I have run this program under Unix. Could the problems I'm having within Windows 2000 be related?
Why would building result in the following message?
Linking...
v3scal.obj : error LNK2005: _FRAME1 already defined in v3grid.obj
Release/hdfviz.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
The common block "FRAME1" is identical in the 4 subroutines, so I don't see why the linker would have a problem with one of them.
I can get the program to link if I comment out the common block in v3scal.f, but then the program crashes with the following message when it tries to read an 11 MB HDF file.
forrtl: severe (157): Program Exception - access violation
I have run this program under Unix. Could the problems I'm having within Windows 2000 be related?
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I reproduced this behavior on UNIX.
Is you situation like this?
The above will fail because fortran sets up two different commons on each object.
To get this to build you need to put them together so fortran treats them as one. In other words don't build two separate object modules containing commons then attempt to link them together.
f90 m.f s.f -o m
m
in main 5 10 20
in s 5 10 20
Is you situation like this?
program m
integer i(3)
common /abc/ i
data i /5,10,20/
print *, 'in main',i
call s
stop
end
subroutine s
integer i(3)
common /abc/ i
data i /5,10,20/
print *, 'in s',i
return
end
f90 -c m.f
f90 -c s.f
f90 -o m m.o s.o
ld:
s.o: abc_: multiply defined
f90: Severe: Failed while trying to link.
The above will fail because fortran sets up two different commons on each object.
To get this to build you need to put them together so fortran treats them as one. In other words don't build two separate object modules containing commons then attempt to link them together.
f90 m.f s.f -o m
m
in main 5 10 20
in s 5 10 20
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry about the above. I appear to be a victim of some problem with cutting and pasting in windows. If I could delete and re-enter the above, I would.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Pat, I fixed your entry. I did so by bracketing the code in
I think you have it right - Arif has DATA-initialized a COMMON block in multiple routines, probably through an INCLUDE file.
Steve
andI also added a FONT SIZE="+1" tag to make it more readable.
I think you have it right - Arif has DATA-initialized a COMMON block in multiple routines, probably through an INCLUDE file.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> Sorry about the above. I appear to be a victim of
> some problem with cutting and pasting in windows.
> If I could delete and re-enter the above, I would.
Welcome to CVF forum, Pat :-). Neither you, nor Windows
are not doing anything wrong -- it's the forum software
that acts smart too much.
See this
thread for explanation on workarounding this.
(sorry, not related with the original post)
Jugoslav
> some problem with cutting and pasting in windows.
> If I could delete and re-enter the above, I would.
Welcome to CVF forum, Pat :-). Neither you, nor Windows
are not doing anything wrong -- it's the forum software
that acts smart too much.
See this
thread for explanation on workarounding this.
(sorry, not related with the original post)
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you folks! I got around my problem by commenting out my DATA statement and using regular assignments within an if-then block that checks whether the routine is being used for the first time. I didn't try simply merging the *.f files so that one big .obj file is created. I didn't have the problem on an HP Visualize workstation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You wouldn't have the problem on OpenVMS either - it all depends on how the linker deals with multiple definitions of an initialized COMMON.
Steve
Steve
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page