LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-04-2004, 08:25 AM   #1
icoming
Member
 
Registered: Feb 2004
Posts: 96

Rep: Reputation: 15
A strange error about c++


LocalFileList.o(.text+0x1a): In function `CLocalFileList::CLocalFileList[not-in-charge](char*)':
/usr/include/sys/stat.h:367: undefined reference to `vtable for CLocalFileList'
LocalFileList.o(.text+0x26):/usr/include/sys/stat.h:367: undefined reference to `vtable for CLocalFileList'
LocalFileList.o(.text+0x32): In function `CLocalFileList::CLocalFileList[not-in-charge](char*)':
/usr/include/c++/3.3.2/bits/basic_string.h:891: undefined reference to `vtable for CLocalFileList'
LocalFileList.o(.text+0x258): In function `CLocalFileList::CLocalFileList[in-charge](char*)':
/home/zd/Projects/ftp/src/LocalFileList.cc:7: undefined reference to `vtable for CLocalFileList'
LocalFileList.o(.text+0x264):/home/zd/Projects/ftp/src/LocalFileList.cc:7: undefined reference to `vtable for CLocalFileList'
LocalFileList.o(.text+0x270):/home/zd/Projects/ftp/src/LocalFileList.cc:7: more undefined references to `vtable for CLocalFileList' follow
collect2: ld returned 1 exit status
make: *** [ftp] Error 1

What does the message mean?
I have define CLocalFileList::CLocalFileList(char*).
 
Old 10-04-2004, 08:29 AM   #2
icoming
Member
 
Registered: Feb 2004
Posts: 96

Original Poster
Rep: Reputation: 15
CLocalFileList has a father class CFileList.
And the relationship of these class is as follow:
CLocalFileList->CFileList->CCombo->CWidget
->CButton->CWidget
->CCtrlList->CWidget
 
Old 10-04-2004, 11:20 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Did you derive (indirectly) a class from CLocalFileList?
My guess is that the contructor needs to be "virtual".
 
Old 10-04-2004, 11:31 AM   #4
icoming
Member
 
Registered: Feb 2004
Posts: 96

Original Poster
Rep: Reputation: 15
But how to make a constructor virtual?
And why g++ says "undefined reference to `vtable for CLocalFileList' "?
 
Old 10-04-2004, 12:03 PM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally posted by icoming
But how to make a constructor virtual?
IIRC (haven't used C++ myself for a while) by putting "virtual" before the decaration (and/or maybe the definition) of the contructor.

Quote:
And why g++ says "undefined reference to `vtable for CLocalFileList' "?
The program doesn't know the address of a virtual function until the program is actually running. When the program in run, it looks up the address from a table in memory, the "vtable".
 
Old 10-04-2004, 07:55 PM   #6
icoming
Member
 
Registered: Feb 2004
Posts: 96

Original Poster
Rep: Reputation: 15
But it's impossible.
If I put "virtual" before the declaration of the constructor,there will be an error when I compile it
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange giftd error voyciz Linux - Software 2 07-19-2004 08:20 PM
xine - strange error edigital Linux - Software 6 02-21-2004 09:02 PM
ps gives me a strange error costasm Linux - Software 6 12-03-2003 07:22 AM
Strange Error..Please HELP!!! skate Linux - Newbie 2 11-23-2003 08:10 AM
2.2 strange error svar Linux - General 0 08-21-2003 01:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration