Error: implicit declaration of function ‘drand48’

I am getting random number related error while using PLUTO astrophysical code. PLUTO code can be downloaded from this link.

/home/raman/Documents/pluto-4.4-patch3/PLUTO/Src/Math_Tools/math_random.c: In function ‘RandomNumber’:
/home/raman/Documents/pluto-4.4-patch3/PLUTO/Src/Math_Tools/math_random.c:94:9: error: implicit declaration of function ‘drand48’; did you mean ‘srand’? [-Wimplicit-function-declaration]
   94 |   rnd = drand48();
      |         ^~~~~~~
      |         srand
/home/raman/Documents/pluto-4.4-patch3/PLUTO/Src/Math_Tools/math_random.c: In function ‘RandomSeed’:
/home/raman/Documents/pluto-4.4-patch3/PLUTO/Src/Math_Tools/math_random.c:171:3: error: implicit declaration of function ‘srand48’; did you mean ‘srand’? [-Wimplicit-function-declaration]
  171 |   srand48(rnd_seq_seed);
      |   ^~~~~~~
      |   srand
make: *** [makefile:96: math_random.o] Error 1

If you have issues with source code - please contact the developers - troubleshooting thirdparty applications is off-topic.

https://groups.google.com/forum/#!forum/pluto_users

That can be bypassed with something like:

  export CFLAGS+=" -Wno-implicit-function-declaration"
  export CXXFLAGS+=" -Wno-implicit-function-declaration"

In pkgbuilds, by compiling manually I’m not sure


I tried to make a pkgbuild for this but it have an interactive and will not dig further

[SOLVED] : - Manjaro uses latest GCC which is 14.2.1, while ubuntu uses 11.2.0 .In latest GCC drand48() function have been depreciated and so i have to manually replace it with rand() function. I did so and it worked fine. I was able to overcome this error by editing that drand48( ) and srand48( ) function with rand( ) and srand( ) respectively in pluto-4.4-patch3/PLUTO/Src/Math_Tools/math_random.c file in my PLUTO software directory.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.