Ask Your Question

Error compiling multiple .F files into single DLL

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

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?

@"C:\Users\Patrick\.pssenvmgr\linkfilestvxtmu.txt" /OUT:"C:\Users\Patrick\.pssenvmgr\AVR1_v34.5.dll"

 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

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


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

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

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

perolofl gravatar imageperolofl ( 2019-07-01 01:24:50 -0500 )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 -0500 )edit

1 answer

Sort by » oldest newest most voted

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

patrickrossiter gravatar image

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


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


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

Seen: 119 times

Last updated: Nov 12 '19