I have a very simple .h/.cpp file pair:
// The .h
class MyClass {
public:
int MyProc();
};
// The .cpp
int MyClass::MyProc() {
return 0;
};
It compiles nicely into a .o file. If I look into the .o with nm, I see
0000000000000000 T _ZN7MyClass6MyProcEv
just as expected. I can link it, etc., everything fine.
If I just change one line in the header to
virtual int MyProc();
the .o file becomes more complicated:
0000000000000000 T _ZN7MyClass6MyProcEv
0000000000000000 V _ZTI7MyClass
0000000000000000 V _ZTS7MyClass
0000000000000000 V _ZTV7MyClass
U _ZTVN10__cxxabiv117__class_type_infoE
by adding the Virtual object elements to it, again as expected. My problem is the Undefined last line. I know that it needs libstdc++, but I do not want to link it later, I want to include it in the .o (or .a) file, so if somebody links my .o (.a) file it does not need any external dependency. How can I do that?