LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-21-2011, 09:12 AM   #1
rindra
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 (http://earthquake.usgs.gov/research/software/#HASH), 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.

Cheers
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-21-2011, 04:09 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156
Welcome to LQ.

Lots of Ubuntu versions. This is Ubuntu 11.04 Natty, 64bits :
Code:
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 :
http://www.linuxquestions.org/questi...-5-a-849259/#3

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

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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.
Code:
ln -s /usr/bin/gfortran $HOME/bin/f77
or change the compiler command inside the Makefile:
Code:
sed -i 's/f77/gfortran/' Makefile
Hope this helps.
 
2 members found this post helpful.
  


Reply


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-18-2010 12:08 AM
Undefined reference to: ashlesha Programming 5 11-08-2006 02:07 PM
undefined reference? Sharky01252 Programming 3 11-07-2006 12:36 PM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 04:01 AM
undefined reference mp4-10 Programming 3 01-25-2005 01:38 PM


All times are GMT -5. The time now is 08:06 PM.

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