Ask Your Question
0

Error compiling multiple .F files into single DLL

asked 2019-06-30 18:03:18 -0600

patrickrossiter gravatar image

Hi there, I am trying to compile multiple Fortran files into a single DLL and am getting the following message when creating the DLL. The files AVR1OEL.F, AVR1UEL.F and AVR1_AVR.F all compile correctly on their own and I can create three usable DLLs, but I want to have only one DLL which contains all three models. Any ideas what is going wrong here?

     link /INCREMENTAL:NO /NOLOGO /DLL /SUBSYSTEM:WINDOWS /MACHINE:X86 /ERRORREPORT:PROMPT
@"C:\Users\Patrick\.pssenvmgr\linkfilestvxtmu.txt" /OUT:"C:\Users\Patrick\.pssenvmgr\AVR1_v34.5.dll"
/map:"C:\Users\Patrick\.pssenvmgr\AVR1_v34.5.map"

 AVR1_OEL.obj : error LNK2005: _MAIN__ already defined in AVR1_AVR.obj
 AVR1_UEL.obj : error LNK2005: _MAIN__ already defined in AVR1_AVR.obj
 C:\Users\Patrick\.pssenvmgr\AVR1_v34.5.dll : fatal error LNK1169: one or more multiply defined symbols
found

 ERROR during link(1)... Aborted
edit retag flag offensive close merge delete

Comments

Also worth noting that I do not have any "main"s in the .F files, and only subroutines have been used (i.e.no programs)

patrickrossiter gravatar imagepatrickrossiter ( 2019-06-30 20:36:14 -0600 )edit

Do you have subroutines with the same name in the three files?

perolofl gravatar imageperolofl ( 2019-07-01 01:24:50 -0600 )edit

Are you defining the same global variables in each *.F file? It's difficult to diagnose your issue without seeing the source code, which I presume is confidential. It is certainly possible to achieve your objective here, it's just a question of structuring your code correctly.

jfconroy gravatar imagejfconroy ( 2019-07-01 05:35:45 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-11-12 18:03:20 -0600

patrickrossiter gravatar image

The answer to this problem was that I had the following code at the end of all of my .F files:

END SUBROUTINE
END

The second "END" did not have a matching statement and when it was removed I was able to compile all three files into a single DLL as required.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2019-06-30 18:03:18 -0600

Seen: 406 times

Last updated: Nov 12 '19