Why i am getting linking errors for the following code?