0
votes

I am trying to compile a fortran code which was last compiled in early 90's on Windows machine using Lahey Fortran . Now, I am compiling with gfortran on ubuntu 64x.

I am getting following error

$ gfortran 3RINGS.FOR /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc10): undefined reference to _mmbsk0_' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc3d): undefined reference tommbsk1' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc6a): undefined reference to _mmbsi0_' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc97): undefined reference tommbsi1' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xcc4): undefined reference to _mmbsk0_' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xcf1): undefined reference tommbsk1' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xd1e): undefined reference to _mmbsi0_' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xd4b): undefined reference tommbsi1' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0x1182): undefined reference to _mmbsk0_' /tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0x11a5): undefined reference tommbsi0' collect2: ld returned 1 exit status

The error is regarding following variable declaration in code

REAL*8 MMBSK0,MMBSK1,MMBSI0,MMBSI1

I will appreciate any suggestion to solve this problem and compile this code. I will be happy to upload the entire code (263 lines) if anybody need that.

1
Are those MMBSK0 used as arrays? In that case there should be a dimension statement somewhere as well. - steabert

1 Answers

0
votes

(Unrelated to your problem - note that REAL*8 is an extension to standard Fortran. The correct syntax is REAL(8), where the meaning of "8" depends on your compiler.)

The compiler thinks those MM... names declare functions, rather than variables. It usually deduces that a name references a function based on the way the name is used later in the code.

I'd guess that there's more to your program than the single source file - perhaps other source files that you need to compile and link in with your main program.