Abstract classes in shared library
Posted
by JTom
on Stack Overflow
See other posts from Stack Overflow
or by JTom
Published on 2010-04-19T00:24:59Z
Indexed on
2010/04/19
0:33 UTC
Read the original article
Hit count: 282
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?
© Stack Overflow or respective owner