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!

g95 error

Status
Not open for further replies.

anoopmj

Programmer
Dec 9, 2009
9
ES
Hello everyone,

I am new to fortran and have been trying to work with g95 on my macbook (snowleopard). I got a code from a trusted website to calculate the rate of photolysis for several chemical species. The manual on the website is very simple and I did everything it said. I think the code is written in f77 but I assumed that g95 should not give many errors. I get the following when I make it:

g95 numer.o functs.o orbit.o TUV.o grids.o rdinp.o rdetfl.o rdxs.o swphys.o swbiol.o swchem.o rxn.o qys.o wshift.o vpair.o vptmp.o vpo3.o odrl.o odo3.o setaer.o setalb.o setcld.o setsnw.o setno2.o seto2.o setso2.o sphers.o la_srb.o rtrans.o savout.o -o tuv
Undefined symbols:
"_plkavg_", referenced from:
_U96.2303 in rtrans.o
"_ftrim_", referenced from:
_U378.3672 in savout.o
ld: symbol(s) not found
make: *** [tuv] Error 1

I don't understand why I get this error. Any help would be useful.

Anoop
 
Eehm, so you compiled it first to get the object files, right?

And it doesn't link...

The only thing that occurs to me is that your code is uncomplete.

Did you compile ALL *.for 's?

 
thanks!

The code automatically compiles all the individual .f's in the folder. I'm not too sure its a problem with the code as many people around the world use it. It seems to be something with my g95 installation maybe?

I've attached the link from where I got the file.

Anoop
 
 http://cdp.ucar.edu/browse/browse.htm?uri=http%3a%2f%2fdataportal.ucar.edu%2fmetadata%2facd%2fsoftware%2fTUV%2fTUV.thredds.xml
Undefined symbols means that the compiler coudn't find the sources for some functions/subroutines (plkavg, ftrim) you try to use.
 
Hm, I don't know about G95, there's a guy (or girl, I don't know, I suppose it's a guy) called xwb active on this forum who seems to know about it.

To make sure it's not your compiler, you could try gfortran, which I'd use. The "gfortran" compiler is free as well (just google on it). You can compile with a simple batch file (I use windows) saying:

gfortran -c mycode_part1.for
gfortran -c mycode_part2.for
etc.

Eventually, it might be necessary to add the commandline option "--fixed-form" if I remember well, to indicate that it's f77 (check whether it is).

You then link with:

gfortran mycode_part1.o mycode_part2.o -o myexe.exe

Nevertheless, it really seems you're missing part of the code or maybe a DLL or something.
 
I understand that the program is having problems reading the subroutines - i don't understand why thought.. :S

I tried compiling only one file at a time now - rtrans.f as that was giving an error earlier. Now it looks like a complete mess:

g95 rtrans.f
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40073:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40088:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40103:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40118:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40133:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40148:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40163:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40182:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40197:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40212:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40227:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40242:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40257:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40272:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40287:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40302:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40317:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40332:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40351:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40366:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40381:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40396:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40411:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40426:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40441:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40456:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40471:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40486:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40501:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40516:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40531:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40546:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40561:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40576:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40591:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40606:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40621:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40636:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40651:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40670:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40685:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40704:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40719:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40734:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40749:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40764:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40779:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40794:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40809:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40824:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40839:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40854:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40869:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40884:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40899:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40914:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40929:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40944:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40959:indirect jmp without `*'
/var/folders/2e/2eAH0wtCE0iLA3aDavu24k+++TI/-Tmp-//ccTVovLD.s:40974:indirect jmp without `*'
Undefined symbols:
"_MAIN_", referenced from:
_main in libf95.a(main.o)
"_plkavg_", referenced from:
_U96.2297 in ccJSoXXK.o
ld: symbol(s) not found

Interestingly it says _main in libf95.a(main.o)

isn't this the fortran library itself? I have gfortran and g95 installed - do you think they could be clashing? I had first installed gfortran but had to install g95 because some of the code I inherited does not work with gfortran.
 
Ah, yes, that happened once to me.

I had two different freeware compilers installed and things didn't compile because there was a conflict between them.

It's quite some time ago and I don't exactly recall which compilers I had. One of them was gfotran and the other one some thing running under MinGW, but I'm not sure to remember well.

What I DO remember is that I took away both compilers and the MinGW and then restarted and reinstalled gfortran. After that it worked. You could try the same keeping only G95 if you like.

(You also better make sure you've got the latest build of the compiler, I happened to solve uncompilable codes in the past just by upgrading my compiler as wel)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top