LNK2001

I've finally gotten my code to the point where it should run without errors but when I try to compile I get this error
Error	2	error LNK2001: unresolved external symbol "public: virtual double __thiscall staffMember::wage(void)" (?wage@staffMember@@UAENXZ)casual.obj

it wont tell me what is causing the error and it mentions a virtual double member the only virtual member in the casual class is the destructor why am I getting this error and how do I get rid of it
This error means that inside the class definition for staffMember (in staffmember.h maybe?) you have declared a function called wage that returns a double and takes no arguments. However the linker cannot find a body for that function. (should probably be in staffmember.cpp). The reason why it references 'casual' is that you must have called that function from somewhere inside that source file.
Last edited on
casual is a class that derived from the base class staffMember the wage function was virtual within staff member I changed that and made it nonvirtual doing so simply replaced the LNK2001 error with a LNK2019 error
Error	2	error LNK2019: unresolved external symbol "public: double __thiscall staffMember::wage(void)" (?wage@staffMember@@QAENXZ) referenced in function _main\main.obj

what causes the 2019
Same thing as your earlier error. You are using a function and it's not defined.
yes Im using a function that isnt defined but when I defined it I still got the lnk2019 error
and if I make the wage function abstract than all kinds of problems occur
Where are you defining it? The linker obviously isn't finding it so you are probably defining it in the wrong place.
I fixed it I was defining it as
double wage()
{

}
instead of
double staffMember::wage()
{

}
Topic archived. No new replies allowed.