Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-21-2011, 08:12 AM   #1
LQ Newbie
Registered: May 2011
Posts: 1

Rep: Reputation: Disabled
undefined reference to `rand_'

Hi guys,

I am a new user in Fortran77. Can someone please help me out with this matter. When I am trying to compile the code in this link (, I get the following error:

fmech_subs.o: In function `focalmc_':
fort77-3595-1.c.text+0xa9f): undefined reference to `rand_'
collect2: ld returned 1 exit status

I have no idea why I got this error on Ubuntu linux. In fact, I have tried it with Mandriva and the compilation went well with no errors.
Thank you in advance for your help.

Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-21-2011, 03:09 PM   #2
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2018 CentOS6.10 CentOS7.5 + 50+ other Linux OS, for test only.
Posts: 17,054

Rep: Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461Reputation: 3461
Welcome to LQ.

Lots of Ubuntu versions. This is Ubuntu 11.04 Natty, 64bits :
cd HASH_v1.2/ && make
f77 fmech_subs.f -O -c
f77 pol_subs.f -O -c
f77 station_subs.f -O -c
f77 uncert_subs.f -O -c
f77 util_subs.f -O -c
f77  hash_driver1.f fmech_subs.o pol_subs.o station_subs.o uncert_subs.o util_subs.o -O -o hash_driver1
The 'g77' package can be installed with 'hardy'
included in the /etc/apt/sources list, please see post #3 here :

Old 05-21-2011, 03:18 PM   #3
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
It compiles well using gfortran too. The GNU compiler provides the rand function for backward compatibility. You can either create a link under your PATH, e.g.
ln -s /usr/bin/gfortran $HOME/bin/f77
or change the compiler command inside the Makefile:
sed -i 's/f77/gfortran/' Makefile
Hope this helps.
2 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Yet another undefined reference CollieJim Linux - General 2 12-17-2010 11:08 PM
Undefined reference to: ashlesha Programming 5 11-08-2006 01:07 PM
undefined reference? Sharky01252 Programming 3 11-07-2006 11:36 AM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 03:01 AM
undefined reference mp4-10 Programming 3 01-25-2005 12:38 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration