Abstract classes in shared library
- by JTom
Hi,
I have an ordinary abstract class that has couple of pure virtual methods. The class itself is a part of the shared library. The compilation of the shared library itself is OK. But when the library is linked to another program that has another class deriving from the abstract one in the shared library and defining the pure virtual methods, I get the following linker error:
I compile like this..:
g++ -I../path/to/the/library main.cpp derived.cpp -L../path/to/the/library -lsomename -o shared
...and the linker error is:
libsomename.so: undefined reference to `AbstractClass::method()'
It's like the abstract class cannot access its pure virtual methods but I do not try to make any instance of the abstract class anywhere in the library.
What could be the problem?