No, this is not required in the cpp file. Only the declaration is required.
For example, if I have a CMyClass class. If I want to export this, then .h will have
.h server code
__ declspec (dllexport) CMyClass {};
In client code, i.e. that uses this class, you must forward the class declaration as
Client code
__ declspec (dllimport) CMyClass;
// Code for using the class
Vinay
source share