473,769 Members | 4,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Undefined reference to vtable

Hi,

I'm confronted with an error here I haven't encountered before (g++ 3.3.5):

Building duality.elf ...
obj_dbg/mainwindow.o(.g nu.linkonce.t._ ZN14TransferDia logC1EN5boost10 shared_ptrI4Tas kEE+0x5c):
In function
`TransferDialog ::TransferDialo g[in-charge](boost::shared_ ptr<Task>)':
/usr/include/c++/3.3/bits/sstream.tcc:57: undefined reference to `vtable
for TransferDialog'
collect2: ld returned 1 exit status
make: *** [duality.elf] Error 1

It seems to come from this class' ctor:

class TransferDialog: public TaskDialog
{
public:
TransferDialog( TaskPtr task_ptr): TaskDialog(task _ptr) {}
virtual int on_progress_upd ate(
const Gnome::Vfs::Asy nc::Handle&,
Gnome::Vfs::Tra nsfer::Progress Info&);
virtual bool on_progress_syn c(
const Gnome::Vfs::Tra nsfer::Progress Info&);
};

here's the base class:

class TaskDialog
{
public:
TaskDialog(Task Ptr task_ptr): task_(task_ptr) {}
virtual ~TaskDialog() {}
virtual int on_progress_upd ate(
const Gnome::Vfs::Asy nc::Handle&,
Gnome::Vfs::Tra nsfer::Progress Info&);
virtual bool on_progress_syn c(
const Gnome::Vfs::Tra nsfer::Progress Info&);
protected:
TaskPtr get_task() const;
private:
TaskPtr task_;
};

TaskPtr is merely a typedef for boost::shared_p tr<Task>. I don't think
the Task class matters here, but if you want me to post it I can surely
do that as well.

It almost looks as if a virtual function is being invoked in the ctor
before the vtable exists, but on the other hand, that's not the case, as
far as I can tell. I don't know what is causing this.

Thanks in advance,
Matthias
Sep 8 '05 #1
3 196495
Matthias Kaeppler wrote:
Hi,

I'm confronted with an error here I haven't encountered before (g++ 3.3.5):

Building duality.elf ...
obj_dbg/mainwindow.o(.g nu.linkonce.t._ ZN14TransferDia logC1EN5boost10 shared_ptrI4Tas kEE+0x5c):
In function
`TransferDialog ::TransferDialo g[in-charge](boost::shared_ ptr<Task>)':
/usr/include/c++/3.3/bits/sstream.tcc:57: undefined reference to `vtable
for TransferDialog'
collect2: ld returned 1 exit status
make: *** [duality.elf] Error 1


As this is a *linker* error, you're probably better off asking this on
a GCC mailing list. In addition to that, the GCC FAQ
(http://gcc.gnu.org/faq.html#vtables) has an entry that might be of
use.

Kristo

Sep 8 '05 #2
Matthias Kaeppler wrote:
Hi,

I'm confronted with an error here I haven't encountered before (g++ 3.3.5):

/usr/include/c++/3.3/bits/sstream.tcc:57: undefined reference to `vtable
for TransferDialog'


That is the most obscure error message the gcc produces, but the reason
is usually simple:

The compiler has to put the vtable into an object file. It puts it into
the object file where the definition of the first non-inline member
function is. If it is missing, you get this rather unhelpful linker
error. Please check the existence of the definitions of your member
functions.

Gabriel
Sep 9 '05 #3
Gabriel wrote:
The compiler has to put the vtable into an object file. It puts it into
the object file where the definition of the first non-inline member
function is. If it is missing, you get this rather unhelpful linker
error. Please check the existence of the definitions of your member
functions.


Argh, you're right. I didn't provide an implementation for one of the
two methods in the subclass, but I declared it in the subclass. I just
removed the declaration so that the default implementation of the base
class will be used, which is what I want at this point.

Thanks,
Matthias

--
Matthias Kaeppler
Sep 9 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8479
by: Daniel Heiserer | last post by:
Hi, I got the following compiling/linking error, but I have no clue what it is about. Can anybody help me? thanks, daniel
2
2529
by: Quansheng Liang | last post by:
Hello, I struggled with the problem of "undefined reference to `vtable ...`" while migrating a project from windows to linux. After searching the google I removed all the inline functions and now the link errors decreased from over 200 to 5. A great step! But one of my class derived from wxValidator can't be linked correctly though there is no any inline function in it. The error message: -----------------------
3
3461
by: bp | last post by:
Hi, Could someone to tell me what I'm doing wrong? I'm using gcc version 3.3.4 and ld version 2.15.90.0.3 20040415 the linker message is: .../obj/classOpenAreaForm.o(.text+0x211): In function `TOpenAreaForm::TOpenAreaForm(TControl*)':
9
3016
by: alessandro | last post by:
Compiling my current project I received the following error: undefined reference to `vtable for Tuner' The only two things I know are that the error occours when trying to invoke the constructor of a class and that concerns virtual functions. What does it mean?
7
1090
by: Karl Ebener | last post by:
Hi! I have created a program using several classes with inheritage. When I compile and link, I get the following error: :$ g++ service2.cpp Service.cpp Application.cpp Message.cpp MessageQueue.cpp MessageFragmenter.cpp SingleMessage.cpp /tmp/ccsrT4jU.o(.gnu.linkonce.t._ZN9c_ServiceD1Ev+0xb): In function `c_Service::~c_Service ()': : undefined reference to `vtable for c_Service'
9
9665
by: jimjim | last post by:
Hello all, class Base { public: virtual void f(); }; class Derived : public Base{ private: int i; };
4
5881
by: Mark | last post by:
Hi, I'm trying to write some classes that kind of manage themselves. A linked list, that links different types of objects. Here's the code... object.h: --- class Object { int alt;
5
11360
by: druberego | last post by:
I read google and tried to find the solution myself. YES I do know that you can get undefined references if you: a) forget to implement the code for a prototype/header file item, or b) you forget to pass all the necessary object files to the linker. Neither of those are my problem. Please bear with me as the question I ask is rather long and I think it's beyond a CS101 level of linker stupidity. If it is a stupid CS101 mistake I'm making...
2
2175
by: boyphp | last post by:
I'm getting the following undefined reference errors: foo_test.o(.gnu.linkonce.t._ZN7CFooD1Ev+0x18): In function `CFoo::~CFoo()': : undefined reference to `vtable for CFoo' foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x19): In function `CFoo::CFoo()': : undefined reference to `CFoo::rmap' foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x30): In function `CFoo::CFoo()':
3
4892
by: chaturap | last post by:
Hi, I'm trying to implement factory method pattern using C++ on Ubuntu 8.04 using gcc 4.2. There are 3 major classes DBConnectionFactory, DBConnector and OracleConnector (which is the derived class of DBConnector). source in separate header and cpp files as below. /* DBConnectionFactory.h */
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.