473,411 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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(.gnu.linkonce.t._ZN14TransferDialogC1 EN5boost10shared_ptrI4TaskEE+0x5c):
In function
`TransferDialog::TransferDialog[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_update(
const Gnome::Vfs::Async::Handle&,
Gnome::Vfs::Transfer::ProgressInfo&);
virtual bool on_progress_sync(
const Gnome::Vfs::Transfer::ProgressInfo&);
};

here's the base class:

class TaskDialog
{
public:
TaskDialog(TaskPtr task_ptr): task_(task_ptr) {}
virtual ~TaskDialog() {}
virtual int on_progress_update(
const Gnome::Vfs::Async::Handle&,
Gnome::Vfs::Transfer::ProgressInfo&);
virtual bool on_progress_sync(
const Gnome::Vfs::Transfer::ProgressInfo&);
protected:
TaskPtr get_task() const;
private:
TaskPtr task_;
};

TaskPtr is merely a typedef for boost::shared_ptr<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 196253
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(.gnu.linkonce.t._ZN14TransferDialogC1 EN5boost10shared_ptrI4TaskEE+0x5c):
In function
`TransferDialog::TransferDialog[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
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
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...
3
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...
9
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...
7
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...
9
by: jimjim | last post by:
Hello all, class Base { public: virtual void f(); }; class Derived : public Base{ private: int i; };
4
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
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...
2
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'...
3
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.