I have a class entitled "Layer" and a derived class entitled "Point". I have a pure virtual function in "Layer" entitled printLayer(). It is not defined in "Layer" although it is defined in "Point".
The program compiles OK, but when I try to build it I get "Unresolved External" errors.
Here is my code for the printLayer() in the "Layer" header:
and "Point" header:
virtual void printLayer(int); //pure virtual function
Here is the code for the printLayer() function in the "Point" defintion:
virtual void printLayer(int); //virtual function with definition
Here is my main program utilizing the classes:
void Point::printLayer(int intArg)
cout << "Point printLayer with argument " << intArg << " !" << endl;
} //end printLayer
Here are the error messages I receive upon using the build command. Note my main program is entitled "test.cpp":
//create a layer object and assign it to a layer pointer
Layer * LayerPtr = new Point("aluspts_0.shp", "C:\\pec\\complete\\vector");
int i = 2;
} //end main
It appears the compiler is searching the "Layer" definitions for the printLayer() function. According to my documentation, a pure virtual function of an abstract base class requires no definition. The definition belongs in the derived class, which is "Point" in my case.
test error LNK2001: unresolved external symbol "public: virtual void __thiscall Layer::printLayer(int)" (?printLayer@Layer@@UAEXH@Z)
test fatal error LNK1120: 1 unresolved externals
Why am I getting these error messages?