0

Hi all,

I added a class named RandomVariableGenerator with the following functions in the .h file

static double GetRandomNumber(void);
static double GetExponential(double beta);
static double GetUnifrom(double a, double b);

but after building them i got the following errors:

Error 1 error LNK2020: unresolved token (06000002) RandomVariableGenerator::GetRandomNumber

Error 3 error LNK2020: unresolved token (06000003) RandomVariableGenerator::GetExponential

Error 6 error LNK2020: unresolved token (06000004) RandomVariableGenerator::GetUnifrom

Thanks in advance...

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Fouly
0

You declare these member functions but forgot to define them.
Probably, you define functions with such names without class name prefix, for example:

double GetRandomNumber() // Ordinar function
{ // does not bear a relation to the class 
    ...
} // You need
double RandomVariableGenerator::GetRandomNumber()
{
    ...
}

Don't use C-style declaration name(void) for a function w/o parameters.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.