Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

duplicate id

Status
Not open for further replies.

anoopmj

Programmer
Dec 9, 2009
9
ES
Hello,

I am trying to compile a code containing many files and I get the following error. I am not too sure what I need to change - any insights would be appreciated.

g95 -cpp -O3 model_Function.o model_Global.o model_Init.o model_Initialize.o model_Integrator.o model_Jacobian.o model_JacobianSP.o model_LinearAlgebra.o model_Main.o model_Model.o model_Monitor.o model_Parameters.o model_Precision.o model_Rates.o model_Util.o constants.o tuv_old/TUV.o tuv_old/functs.o tuv_old/grids.o tuv_old/la_srb.o tuv_old/numer.o tuv_old/odo3.o tuv_old/odrl.o tuv_old/orbit.o tuv_old/qys.o tuv_old/rdetfl.o tuv_old/rdinp.o tuv_old/rdxs.o tuv_old/rtrans.o tuv_old/rxn.o tuv_old/savout.o tuv_old/setaer.o tuv_old/setalb.o tuv_old/setcld.o tuv_old/setno2.o tuv_old/seto2.o tuv_old/setsnw.o tuv_old/setso2.o tuv_old/sphers.o tuv_old/swbiol.o tuv_old/swchem.o tuv_old/swphys.o tuv_old/vpair.o tuv_old/vpo3.o tuv_old/vptmp.o tuv_old/wshift.o -o model
ld: duplicate symbol _MAIN_ in tuv_old/TUV.o and model_Main.o
make: *** [model] Error 1

Cheers,

Anoop
 
The compiler said, that both object files TUV.o and model_Main.o contain the main program section.
Look in the sources i.e in TUV.f95 and model_Main.f95 and correct it - only one of them should contain the main program.
 
What do you mean by the "main program section"? I looked through the files and none of them say anything about "main", except in the comments.
 
I mean, that only one of the source files should contain a section line
Code:
program [i]pgm_name[/i]
...
end program [i]pgm_name[/i]
other source files should contain only SUBROUTINEs, FUNCTIONs, MODULEs ...

 
That's what I thought.. :)
Unfortunately my files say

PROGRAM driver
...

END PROGRAM driver

and

PROGRAM tuv

END

I couldn't see the word main anywhere.
 
You don't see main, because under the symbol _MAIN_ the compiler means main program.
So you see, taht you have 2 main programs, what you try to link together. The compiler cannot decide what of the both is right.

Try to compile and link all your sources first with one i.e. model_Main.f95 and then with second i.e. TUV.f95 and you will see what comes out.

Maybe TUV.f95 is the old version of the program, because it's placed in directory tuv_old, or not ?

 
Thanks. I'll give that a go.

TUV is not an old program.. just my weird way of storing files.

More soon!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top