For Programmers: Free Programming Magazines  


Home > Archive > Fortran > August 2005 > help regarding installing randlib









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author help regarding installing randlib
student

2005-08-23, 7:00 pm

Hi!

I am trying to use randlib90 for purpose of a simulation study. I have
already compiled the source codes in and formed a library librandlib.a.
Also, I have put all the .mod files in a folder called mod.

Now with USE user_set_generator on the top of the main program unit, I
am able to compile my code without any error messages with the
following command:

g95 sim_coverage3.f90 -lrandlib90 -L../../randlib90
-I../../randlib90/mod


In the next step, I try to CALL a subroutine time_set_seeds which is
contained in the module user_set_generator, and I get the following
error message:

g95 sim_coverage3.f90 -lrandlib90 -L../../randlib90
-I../../randlib90/mod
/tmp/ccBb8IMM.o(.text+0x3d22): In function `MAIN_':
sim_coverage3.f90: undefined reference to `time_set_seeds__'

Can anyone explain what's going on here?

Thanks

Richard E Maine

2005-08-23, 7:00 pm

In article <1124833119.575268.257370@g44g2000cwa.googlegroups.com>,
"student" <adarsh@stat.tamu.edu> wrote:

> Now with USE user_set_generator on the top of the main program unit,...
> In the next step, I try to CALL a subroutine time_set_seeds which is
> contained in the module user_set_generator,...

....
> sim_coverage3.f90: undefined reference to `time_set_seeds__'
>
> Can anyone explain what's going on here?


That looks to me like it is trying to find a time_set_seeds that is not
in a module. Why that is would be hard for me to say because you haven't
actually shown the relevant code, so I can't tell what is going on.

One of the main rules of asking for debugging help is to show what you
did instead of describing it. You just described the USE statement, the
CALL, and the presence of the subroutine in the module. Presumably
something isn't as you think it is, but all I have is the description of
what you think things are like. The number of ways that I can imagine
you might have gone wrong is too large to list... and the actual problem
likely is in the even larger list of things that didn't occur to me.

I suggest showing actual code, ideally cut down if it is a big code.
Shouldn't take more than a handful of lines to illustrate a problem like
that, after all.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
glen herrmannsfeldt

2005-08-23, 7:00 pm

Richard E Maine wrote:

> One of the main rules of asking for debugging help is to show what you
> did instead of describing it. You just described the USE statement, the
> CALL, and the presence of the subroutine in the module. Presumably
> something isn't as you think it is, but all I have is the description of
> what you think things are like. The number of ways that I can imagine
> you might have gone wrong is too large to list... and the actual problem
> likely is in the even larger list of things that didn't occur to me.


> I suggest showing actual code, ideally cut down if it is a big code.
> Shouldn't take more than a handful of lines to illustrate a problem like
> that, after all.


I believe the GNU rule for bug reports is something like the smallest
compilable example that shows the bug. That isn't always easy, but for
one like this it should be pretty easy to make a minimal example.

-- glen

student

2005-08-24, 7:56 am

I am using randlib90 user_set_generator module. I have put the USE
statement in my code to use this module. Both set_seeds and
time_set_seeds are subroutines contained in this module. set_seeds has
an optional integer argument, whereas time_set_seeds doesnot have any
arguments. When I put the following statement in my code:

CALL set_seeds(2) ; the program compiles and runs well

However, when I put the following statement in my code:

CALL time_set_seeds ; I get the error message as:


/tmp/ccJmPFep.o(.text+0x8d27): In function `MAIN_':
sim_coverage3.f90: undefined reference to `time_set_seeds__'



What really baffles me is if one subroutine contained in the same
module is running fine, then how could one get a compilation error for
the other one?

student

2005-08-24, 7:56 am

and what's even more baffling is that when the argumant for set_seeds
is 1, then it calls time_set_seeds. I tried giving that argument and
the program seems to be working well

Jugoslav Dujic

2005-08-24, 7:56 am

student wrote:
| I am using randlib90 user_set_generator module. I have put the USE
| statement in my code to use this module. Both set_seeds and
| time_set_seeds are subroutines contained in this module. set_seeds has
| an optional integer argument, whereas time_set_seeds doesnot have any
| arguments. When I put the following statement in my code:
|
| CALL set_seeds(2) ; the program compiles and runs well
|
| However, when I put the following statement in my code:
|
| CALL time_set_seeds ; I get the error message as:
|
|
| /tmp/ccJmPFep.o(.text+0x8d27): In function `MAIN_':
| sim_coverage3.f90: undefined reference to `time_set_seeds__'

Sounds as if set_seeds is declared PUBLIC while time_set_seeds is not.

--
Jugoslav
___________
www.geocities.com/jdujic

Please reply to the newsgroup.
You can find my real e-mail on my home page above.

Dr Ivan D. Reid

2005-08-24, 6:59 pm

On Wed, 24 Aug 2005 12:46:09 +0200, Jugoslav Dujic <jdujic@yahoo.com>
wrote in <3n31faF1960jmU1@individual.net>:
> student wrote:
>| I am using randlib90 user_set_generator module. I have put the USE
>| statement in my code to use this module. Both set_seeds and
>| time_set_seeds are subroutines contained in this module. set_seeds has
>| an optional integer argument, whereas time_set_seeds doesnot have any
>| arguments. When I put the following statement in my code:


>| CALL set_seeds(2) ; the program compiles and runs well


>| However, when I put the following statement in my code:


>| CALL time_set_seeds ; I get the error message as:


>| /tmp/ccJmPFep.o(.text+0x8d27): In function `MAIN_':
>| sim_coverage3.f90: undefined reference to `time_set_seeds__'


> Sounds as if set_seeds is declared PUBLIC while time_set_seeds is not.


That is exactly the case (in the source package I found, anyway).

--
Ivan Reid, Electronic & Computer Engineering, ___ CMS Collaboration,
Brunel University. Ivan.Reid@[brunel.ac.uk|cern.ch] Room 40-1-B12, CERN
KotPT -- "for stupidity above and beyond the call of duty".
student

2005-08-24, 6:59 pm

Thanks everyone. The problem was indeed that the default accessibility
in the module user_set_generator was set as private. i changed the
accessibility of time_set_seeds and now it seems to be working fine.

bwb

2005-08-24, 6:59 pm

Bingo!

set_seeds is public in the module but time_set_seeds is not (defult
declaration is
private). I thought the docs said to use set_seeds but I may be wrong.

I am the author of randlib90.

Barry W. Brown
bwb@mdanderson.org

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com