473,465 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

HELP: wxValidator and undefined reference to `vtable ...` under linux

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:
-----------------------
Linking...
/home/qsliang/projects/ezData/Debug/validator.o(.text+0x19): In
function `ezValidatorLong::ezValidatorLong[not-in-charge](long*)':
/usr/local/include/wx/string.h:717: undefined reference to `vtable for
ezValidatorLong'
/home/qsliang/projects/ezData/Debug/validator.o(.text+0x55): In
function `ezValidatorLong::ezValidatorLong[in-charge](long*)':
src/helper/validator.cpp:22: undefined reference to `vtable for
ezValidatorLong'
/home/qsliang/projects/ezData/Debug/validator.o(.text+0x91): In
function `ezValidatorLong::ezValidatorLong[not-in-charge](long*, long,
long)':
src/helper/validator.cpp:27: undefined reference to `vtable for
ezValidatorLong'
/home/qsliang/projects/ezData/Debug/validator.o(.text+0xcb): In
function `ezValidatorLong::ezValidatorLong[in-charge](long*, long,
long)':
src/helper/validator.cpp:27: undefined reference to `vtable for
ezValidatorLong'

My class (in two files):
------------------------
class ezValidatorLong : public wxValidator
{
private:
long *mpValue, mMin, mMax;

public:
ezValidatorLong(long *pValue);
ezValidatorLong(long *pValue, long xMin, long xMax);
// ~ezValidatorLong();

wxObject* Clone() const;
bool Validate(wxWindow* pParent);
bool TransferFromWindow();
bool TransferToWindow();
};
ezValidatorLong::ezValidatorLong(long *pValue)
{ mpValue = pValue;
mMin = 1;
mMax = 0;
}
ezValidatorLong::ezValidatorLong(long *pValue, long xMin, long xMax)
{ mpValue = pValue;
mMin = xMin;
mMax = xMax;
}
//ezValidatorLong::~ezValidatorLong(){}
wxObject* ezValidatorLong::Clone() const
{ return new ezValidatorLong(mpValue,mMin,mMax);
}

bool ezValidatorLong::Validate(wxWindow*)
{ return // do-check //;
}

bool ezValidatorLong::TransferFromWindow()
{ wxString s = ((wxTextCtrl*)GetWindow())->GetValue();
s.ToLong(mpValue);
return true;
}
bool ezValidatorLong::TransferToWindow()
{ wxString s;
s.Printf("%ld",*mpValue);
((wxTextCtrl*)GetWindow())->SetValue(s);
return true;
}

--------------------------
The destructor, Clone(), Validate(), Transfer..Window() in wxValidator
are virtual. In my class, I got the same result no matter if there is
a destructor.
In the project, wxValidator is also used directly muliple times
without problem.

Any suggestion will be highly appreciated!
Liang
Jul 22 '05 #1
2 2499
g++ ... -fvtable-thunks ...

BTW, that's OT here...

-Gernot
Jul 22 '05 #2
The problem solved:
by adding
#pragma implementation "validator.h"
in the front of the validator.cpp.
What's the statement mean?
Liang

li***@ezget.net (Quansheng Liang) wrote in message news:<30**************************@posting.google. com>...
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:
-----------------------
Linking...
/home/qsliang/projects/ezData/Debug/validator.o(.text+0x19): In
function `ezValidatorLong::ezValidatorLong[not-in-charge](long*)':
/usr/local/include/wx/string.h:717: undefined reference to `vtable for
ezValidatorLong'
/home/qsliang/projects/ezData/Debug/validator.o(.text+0x55): In
function `ezValidatorLong::ezValidatorLong[in-charge](long*)':
src/helper/validator.cpp:22: undefined reference to `vtable for
ezValidatorLong'
/home/qsliang/projects/ezData/Debug/validator.o(.text+0x91): In
function `ezValidatorLong::ezValidatorLong[not-in-charge](long*, long,
long)':
src/helper/validator.cpp:27: undefined reference to `vtable for
ezValidatorLong'
/home/qsliang/projects/ezData/Debug/validator.o(.text+0xcb): In
function `ezValidatorLong::ezValidatorLong[in-charge](long*, long,
long)':
src/helper/validator.cpp:27: undefined reference to `vtable for
ezValidatorLong'

My class (in two files):
------------------------
class ezValidatorLong : public wxValidator
{
private:
long *mpValue, mMin, mMax;

public:
ezValidatorLong(long *pValue);
ezValidatorLong(long *pValue, long xMin, long xMax);
// ~ezValidatorLong();

wxObject* Clone() const;
bool Validate(wxWindow* pParent);
bool TransferFromWindow();
bool TransferToWindow();
};
ezValidatorLong::ezValidatorLong(long *pValue)
{ mpValue = pValue;
mMin = 1;
mMax = 0;
}
ezValidatorLong::ezValidatorLong(long *pValue, long xMin, long xMax)
{ mpValue = pValue;
mMin = xMin;
mMax = xMax;
}
//ezValidatorLong::~ezValidatorLong(){}
wxObject* ezValidatorLong::Clone() const
{ return new ezValidatorLong(mpValue,mMin,mMax);
}

bool ezValidatorLong::Validate(wxWindow*)
{ return // do-check //;
}

bool ezValidatorLong::TransferFromWindow()
{ wxString s = ((wxTextCtrl*)GetWindow())->GetValue();
s.ToLong(mpValue);
return true;
}
bool ezValidatorLong::TransferToWindow()
{ wxString s;
s.Printf("%ld",*mpValue);
((wxTextCtrl*)GetWindow())->SetValue(s);
return true;
}

--------------------------
The destructor, Clone(), Validate(), Transfer..Window() in wxValidator
are virtual. In my class, I got the same result no matter if there is
a destructor.
In the project, wxValidator is also used directly muliple times
without problem.

Any suggestion will be highly appreciated!
Liang

Jul 22 '05 #3

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

Similar topics

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; };
5
by: pavan734 | last post by:
Hi, Iam facing problem with undefined reference linking errors. To explain in more detail.. I have a class called TOP. In its constructor I have instantiated many other class objects using...
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...
6
by: Neo | last post by:
I have a setup like class A { virtual void func1()=0; ..... } class B { virtual void func2()=0; .... } class C: public A, public B {
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
1
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.