LinuxQuestions.org
Visit Jeremy's Blog.
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-12-2010, 03:31 PM   #1
moskymoe
LQ Newbie
 
Registered: May 2010
Posts: 1

Rep: Reputation: 0
GNU issues: undefined reference to '_rand'


Greetings,

I am trying to compile legacy a code that worked well with f77 and g77 on linux platform. I am trying to use g95 since f77 and g77 are not available. The code is mostly in fortran and uses few c functions among. I am getting the undefined reference error for rand:

(.data+0x4): undefined referenec to '_rand'


I am defining my own function RANDOM and rand in an include file but I am not sure why it is failing to link and giving me such error?


external rand
double precision rand

#define RANDOM rr(nq)


I am puzzled by why g95 is giving me such issues?!


thanks!
 
Old 05-12-2010, 11:31 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi, welcome to LQ!

How are you invoking the compiler? For all I know you simply haven't
told it which library to link your old code against. The error you
see is not a compiler error, it's a linker one.



Cheers,
Tink
 
Old 05-13-2010, 04:49 AM   #3
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
Quote:
... f77 and g77 are not available..
f77 and g77 are "always" available.

But you will have to tell, which Linux OS, you are using.

Should be be told by every question :
http://www.linuxquestions.org/linux/...Ask_a_Question
..
 
  


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
Undefined reference, why? george_mercury Programming 4 05-07-2009 12:15 AM
undefined reference to... dimah Programming 3 12-27-2006 09:57 AM
Undefined reference to: ashlesha Programming 5 11-08-2006 01:07 PM
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 10:40 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