-
unresolved external...
hi... i wrote a relatively large program and everything compiles fine, however the linker give me such error...
--------------------Configuration: Assignment4 - Win32 Debug--------------------
Linking...
Assignment4.obj : error LNK2001: unresolved external symbol "void __cdecl calc_positive_average(double &,int &,int &)" (?calc_positive_average@@YAXAANAAH1@Z)
Debug/Assignment4.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Assignment4.exe - 2 error(s), 0 warning(s)
..............
if someone could look at this and explain it to me...perhaps you can give me a solution, i included below the function declaration and its definition (where the problem occurs)
Code:
(DECLARATION)
void calc_positive_average(double& positive_average,
int& positive_sum,
int& positive_counter);
Code:
(DEFINITION)
// calc_postive_average() designed for calculating the average of positive
// integers.
//
// Parameters: address of positive_average, postive_sum and positive_counter
// Return Value: void
void calc_postive_average(double& positive_average,
int& positive_sum,
int& positive_counter)
{
static_cast<double>(positive_counter); // casting to "double" so we'll get
// double as a result of division.
positive_average = (positive_sum / positive_counter);
}
thanks in advance
matheo917
-
in the implementation the function name is spelled wrong..
void calc_positive_average(double& positive_average,
int& positive_sum,
int& positive_counter)
{
static_cast<double>(positive_counter); // casting to "double" so we'll get
// double as a result of division.
positive_average = (positive_sum / positive_counter);
}
-
>> in the implementation the function name is spelled wrong
tsk tsk ...
-
thanx....
hmmm... i wonder how come the compiler didn't find the syntax error in this case, it wound some other once ...
thanx...
it works now
thanx
-
I hate that error. I've had it so much though I'm pretty good at figuring it out.
Sometimes if you include a file and the last line of the file doesn't have a semicolon or something of the sort then you don't get an error in that file, but get an error in whatefver files you include it in, which can be really hard to uncvoer.
But most of the time if the prototype and implementation don't match you get that error alot.