xrk4.c from NRC


ALI_AT_RMC
08-17-2006, 07:29 PM
I'm trying to run the example 'xrk4.c' with a great deal of difficulty. I have included nr.h and nrutil.h along with source files nutil.c and rk4.c and the code will not compile. The errors are linking errors:

Undefined symbol '_bessj" referenced in "xrk4.c"
Undefined symbol '_bessj0" referenced in "xrk4.c"
Undefined symbol '_bessj1" referenced in "xrk4.c"

I've attempted to run this code in three different compilers with no success - so it must be something that I'm doing.

Any suggestions are appreciated.

ALI

Saul Teukolsky
08-21-2006, 10:58 AM
Dear Ali,

The example uses Bessel functions. You need to also compile and link bessj0.c, bessj1.c and bessj.c.

Saul Teukolsky

ALI_AT_RMC
09-25-2006, 11:31 AM
Thank you very much for pointing that out Mr. Teukolsky. It was a silly mistake on my part.

I have since added the appropriate bessj recipes to the code. The error I'm getting now involves nrutil.c whereby the message I keep getting each time I run the code is:

NON-FATAL RUN-TIME ERROR: "nrutil.c", line 25, col 12, thread id 0x000000C0: Out-of-bounds pointer arithmetic: 4 bytes (1 elements) before start of array.

I'm I doing something wrong or do I need to fiddle with the settings of my compiler?

Thanks again,

ALI

Saul Teukolsky
09-25-2006, 12:23 PM
Dear Ali,

This should not cause a problem. If you are curious about why your compiler is complaining (most don't), read the section on unit-offset vectors in Appendix B. If you have a compiler option that let's you turn off checking the pointer arithmetic, you could try that.

Saul Teukolsky