LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   GNU issues: undefined reference to '_rand' (https://www.linuxquestions.org/questions/linux-newbie-8/gnu-issues-undefined-reference-to-_rand-807456/)

moskymoe 05-12-2010 03:31 PM

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!

Tinkster 05-12-2010 11:31 PM

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

knudfl 05-13-2010 04:49 AM

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
..


All times are GMT -5. The time now is 06:20 AM.