LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 08: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, 03:09 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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, 03:18 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:11 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
Open Source Consulting | Domain Registration