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...

Recommended Answers

All 2 Replies

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.

it works greatly...thanks a lot Arkm.

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.