A project consists of the following class (further functions are omitted):
// MyClass.h
class MyClass {
public:
virtual void print();
};
// MyClass.cpp
#include "stdafx.h"
#include "MyClass.h"
void MyClass::print() {
// empty
}
In ANOTHER project a class is derived from MyClass
. The print
function is not overwritten. In the linking step after the compilation a definition of the function print
can't be found ("unresolved external symbol" error). How can I fix this issue? The project with the MyClass.h
and MyClass.cpp
is referenced in the project.
Edit: Development Environment is VS 2015 on Win10 x64. If I remove the keyword virtual
or move MyClass.h and MyClass.cpp to the other project the error doesn't occur anymore.
Edit 2: Both projects are dynamic libraries (DLLs).