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 2 2499
g++ ... -fvtable-thunks ...
BTW, that's OT here...
-Gernot
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
by: jimjim |
last post by:
Hello all,
class Base {
public:
virtual void f(); };
class Derived : public Base{
private:
int i; };
|
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...
|
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...
|
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 {
|
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'...
|
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...
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
|
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: 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...
|
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 ...
| |