Linker Error Undefined Reference To Vtable For
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of
Error Undefined Reference To Vtable For Qt
this site About Us Learn more about Stack Overflow the company Business the vtable symbol may be undefined because the class is missing its key function Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Undefined Reference To Vtable For Constructor
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up undefined reference to vtable for destructor Linker Error: Undefined Reference to `vtable for square` up vote 0 down vote favorite 1 I've checked the most common undefined reference to vtable question on here, and while that gave me a better understanding of what is going on, I still wasn't able to gather enough information to figure out why I'm having this error. I have a simple Square class, which, undefined reference to vtable for c++ originally I was trying to inherit from a Polygon class. Since I've been relatively knew to C++ and still learning, I haven't experimented with Polymorphism all that much. Anyway, after I tried getting rid of the base class (Polygon), I thought that might help things. Unfortunately, I'm still getting the same error, and I don't quite know what is going on. What I do know is that originally, the Polygon class required a source file with at least a constructor definition, which I did give. That got rid of the vtable error for the Polygon class. My main issue is that I'm still getting this for the Square class, which was supposed to inherit from the Polygon class. What I'd like to know is how can I implement this properly to avoid getting a vtable error while still getting the benefits of Polymorphism? Code Polygon.h/.cpp #ifndef POLYGON_H #define POLYGON_H #include "Shape.h" #include "vector3f.h" class Polygon { public: Polygon(); virtual void Collide(Shape &s) = 0; virtual void Collide(Polygon &p) = 0; virtual bool Intersects(const Shape &s) = 0; virtual bool Intersects(const Polygon &s) = 0; protected: virtual void
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta
Undefined Reference To `typeinfo For
Discuss the workings and policies of this site About Us Learn undefined reference to vtable for qobject more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us
Undefined Reference To Vtt For
Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, http://stackoverflow.com/questions/8830025/linker-error-undefined-reference-to-vtable-for-square helping each other. Join them; it only takes a minute: Sign up Linker error: undefined reference to vtable [duplicate] up vote 2 down vote favorite This question already has an answer here: What is an undefined reference/unresolved external symbol error and how do I fix it? 25 answers I'm hoping that you can help me with my http://stackoverflow.com/questions/15154980/linker-error-undefined-reference-to-vtable problem, this program is a theater reservation program. main.cpp { #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have http://stackoverflow.com/questions/7665190/undefined-reference-to-vtable-for-xxx Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us http://www.cplusplus.com/forum/general/69623/ Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like undefined reference you, helping each other. Join them; it only takes a minute: Sign up Undefined reference to 'vtable for xxx' up vote 30 down vote favorite 9 takeaway.o: In function `takeaway': project:145: undefined reference to `vtable for takeaway' project:145: undefined reference to `vtable for takeaway' takeaway.o: In function `~takeaway': project:151: undefined reference to `vtable for takeaway' project:151: undefined reference to undefined reference to `vtable for takeaway' takeaway.o: In function `gameCore': project.h:109: undefined reference to `gameCore
on a plugin framework for an application, which will work by dynamically loading shared/dynamic libraries that contain classes (unknown to the application) that derive from base classes (known to the application). I'm using MinGW with GCC and GNU-Make. The compiler output is below, including the rather strange linker error. g++ -DBUILDING_DLL -c -o plugin.o classes.cpp g++ -shared -o plugin.dll plugin.o plugin.o:classes.cpp:(.text$_ZN9baseClassC2Ev[baseClass::baseClass()]+0x8): undefined reference to `vtable for baseClass' collect2: ld returned 1 exit status mingw32-make: *** [plugin.dll] Error 1 The problem appears to be in baseClass' constructor, which I haven't defined. I get the same error, but twice, if I define baseClass' constructor as 'baseClass() {}', as I did with derivedClass (see code). The code isn't too long, I'll post it below. Help is appreciated. I think I'm doing something wrong with constructors, but I'm not sure what. classes.h 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// classes.h #ifndef CLASSES_H #define CLASSES_H #ifdef BUILDING_DLL #define DLL_INTERFACE __declspec(dllexport) #else #define DLL_INTERFACE __declspec(dllimport) #endif class DLL_INTERFACE baseClass { public: virtual void testFunc(); }; class DLL_INTERFACE derivedClass : public baseClass { public: derivedClass() {}; ~derivedClass() {}; void testFunc(); private: void privateFunc(); }; #endif classes.cpp: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// classes.cpp #include