Hi,

I use Fedore Eclipse IDE to run C++ code. I need to use the Scythe Statistical toolbox which implements random number generators from different functions (gamma, beta etc). I have added the toolbox's location to the path of header files in Eclipse and added the

#include "distribution"

(available in this toolbox) at the beginning of my code. From 'distribution.h' I need to use the gammafn function. Its function declaration is:

double gammafn (double val)

Therefore in the my C++ code, I just have a function call :

double k=gammafn(5.0);

I get an error saying 'undefined function: function not declared in scope'.

I am not sure if I have missed in the code or in Eclipse.
Please advice.

Recommended Answers

All 3 Replies

The function is defined in a namespace:

namespace scythe {
  
  /*! @cond */
  
  /* Forward declarations */
  double gammafn (double);

So you have to call it like this:

double k=scythe::gammafn(5.0);

It seems completely crazy to me that they do not include any examples!!

Good luck.

Dave

Also, I notice you only have

#include "distribution"

if daviddoria's suggestion doesn't help, try adding a ".h" to the name i.e.:

#include "distribution[B].h[/B]"

Dear Daviddoria and Fbody,

I have just retained it as #include "distribution" and used the 'scythe::' to call the function. It has worked now :). Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.