I am porting a game from windows to mac.
Here I am stuck with a bunch of linker errors. All errors similar to
Undefined symbols "typeinfo for Baseclass", referenced from: typeinfo for Subclass Subclass.o
or
"vtable for Aclass referenced from _ZTVNAclass:`
I know that the problem because of missing definition for virtual functions. Its big project and difficult to trace undefined virtual functions. Is their any way to quickly identify undefined virtual functions.
Why cant the compiler identify undefined virtual functions and give a meaningful message instead of cryptic vtable message.
Minimal example :-
class Foo
{
public:
virtual ~Foo(){};
virtual void someMethod();
};
int main()
{
Foo foo;
return 0;
}
And g++ version 4.2.1 (Apple Inc. build 5664) says:-
Undefined symbols:
"vtable for Foo", referenced from:
Foo::Foo() in ccj8yYI2.o
ld: symbol(s) not found
collect2: ld returned 1 exit status