public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* undefined reference to vtable for xxx
@ 2008-01-28 18:57 David H. Lynch Jr.
  2008-01-29  0:47 ` Rüdiger Ranft
  2008-01-29  1:31 ` Philipp Thomas
  0 siblings, 2 replies; 6+ messages in thread
From: David H. Lynch Jr. @ 2008-01-28 18:57 UTC (permalink / raw)
  To: gcc-help

>On Sat, 26 Jan 2008 04:20:54 -0500, David H. Lynch Jr. wrote:

>>    I am getting a plethora of the above errors.

>Please do paste at least part of the messages you get, along with the
>command line for the compiler. No interpretation or anything like it,
>just plian cut&paste.

>Philipp

	
	What you asked is below. The class Bluetooth inherits from the class wxPanel, ...
But I am not really looking for a specific answer to my specific problem.
I bump into this particular problem fairly regularly porting working windows C++ code to GCC.
Chasing down every method from a parent to a child - when I am not intimate with either the parent or child classes, 
wwhere the parent class is often from some toolkit and itself may be fairly deep in an object tree, is tedious - it is the kind of job tools are supposed to do for us.

	I appreciate that while the windows code may work, something is not quite kosher about the code and VC++ is either making assumptions
or getting by because whatever is not properly defined is never used.

	What I am really after is some clue how to figure out where the real underlying ambiguity in the code actually is.
Aside from the fact that the error itself is uninformative, the "help" I have found by googling - there is some key method in the parent class that is not in the 
child is not big help either.

	Is there any GCC option that will pry more information on this from GCC, Like what method is missing from child ?  
   

g++ -D_CRT_SECURE_NO_DEPRECATE -DUSING_GUI -DOPENSSL -DWX_WIDGETS	-DPICO_WIDGETS	-I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -g3 -DLINUX -Ddhlii -I. -I/usr/src/pico/git/software/include -fmessage-length=0 -fdiagnostics-show-option -fms-extensions -Wno-multichar -I../cowpatty/WpdPack/Include -I../occommon -I../cowpatty -Ilibtommath-0.39  -DOSNAME="Linux" -fstack-protector-all -DPOSIX -I/usr/src/pico/git/software/include/posix -o chipper ChipperRevised.cpp ChipperFrame.cpp Bluetooth.cpp GridCellChoiceRenderer.cpp EzGrid.cpp FastComboEditor.cpp Filevault.cpp FVfpga.cpp Lanman.cpp sha1.cpp WEP.cpp WPA.cpp WPAfpga.cpp Zip.cpp Zipfpga.cpp ../winzipcrack/aescrypt.cpp ../winzipcrack/aeskey.cpp ../winzipcrack/aestab.cpp ../btpincrack/e.cpp ../btpincrack/my_getopt.c ../btpincrack/safer.cpp ../cowpatty/md5.cpp ../cowpatty/utils.cpp ../source/GString.cpp ../picoutil/pico_errors_client.cpp ../source/loadDll.cpp CompiledXRC.cpp ../source/posix/file.cpp ../source/posix/dll.cpp ../source/posix/findfile.cpp /usr/src/pico/git/software/source/posix/posix.cpp     -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8  -lcrypto -lpcap  


/tmp/ccH5bKOc.o: In function `Bluetooth':
/var/lib/git/pico/software/chipper/Bluetooth.cpp:47: undefined reference to `vtable for Bluetooth'
/var/lib/git/pico/software/chipper/Bluetooth.cpp:47: undefined reference to `vtable for Bluetooth'
/tmp/ccH5bKOc.o: In function `~Bluetooth':
/var/lib/git/pico/software/chipper/Bluetooth.cpp:64: undefined reference to `vtable for Bluetooth'
/var/lib/git/pico/software/chipper/Bluetooth.cpp:64: undefined reference to `vtable for Bluetooth'
/var/lib/git/pico/software/chipper/Bluetooth.cpp:64: undefined reference to `vtable for Bluetooth'



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to vtable for xxx
  2008-01-28 18:57 undefined reference to vtable for xxx David H. Lynch Jr.
@ 2008-01-29  0:47 ` Rüdiger Ranft
  2008-01-29  1:31 ` Philipp Thomas
  1 sibling, 0 replies; 6+ messages in thread
From: Rüdiger Ranft @ 2008-01-29  0:47 UTC (permalink / raw)
  To: David H. Lynch Jr.; +Cc: gcc-help

Am Montag, 28. Januar 2008 01:46 schrieb David H. Lynch Jr.:

> 	What you asked is below. The class Bluetooth inherits from the class
> wxPanel, ... But I am not really looking for a specific answer to my
> specific problem. I bump into this particular problem fairly regularly
> porting working windows C++ code to GCC. Chasing down every method from a
> parent to a child - when I am not intimate with either the parent or child
> classes, wwhere the parent class is often from some toolkit and itself may
> be fairly deep in an object tree, is tedious - it is the kind of job tools
> are supposed to do for us.

Problems of this kind arise when the vtable of the derived class is not linked 
to the binary. g++ put the vtable in the object file where the first 
non abstract virtual method of the object is defined. This behavior also gives 
problems if the first virtual function is inline. In this second case the 
compiler yields the vtable in ervery object file where the class header is 
included.

bye
Rudi

-- 
GPG encrypted mails preferred.
GPG verschlüsselte Mails bevorzugt.
---> http://chaosradio.ccc.de/media/ds/ds085.pdf Seite 20 <----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to vtable for xxx
  2008-01-28 18:57 undefined reference to vtable for xxx David H. Lynch Jr.
  2008-01-29  0:47 ` Rüdiger Ranft
@ 2008-01-29  1:31 ` Philipp Thomas
  2008-02-01  7:54   ` David H. Lynch Jr.
  1 sibling, 1 reply; 6+ messages in thread
From: Philipp Thomas @ 2008-01-29  1:31 UTC (permalink / raw)
  To: gcc-help

On Sun, 27 Jan 2008 19:46:13 -0500, David H. Lynch Jr. wrote:

>Is there any GCC option that will pry more information on this from GCC,
>Like what method is missing from child ?  

There isn't an option that helps you track the problem.

Besides that which has be said already, this warning also comes when
different parts of the code see differing declarations, one with and one
without 'virtual'.

> -fms-extensions

BTW on a side note: If at all possible, get rid of that option (i.e.
change the code that needs it), because it allows IMNSHO very dubious MS
extensions to C++.

Philipp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: undefined reference to vtable for xxx
  2008-01-29  1:31 ` Philipp Thomas
@ 2008-02-01  7:54   ` David H. Lynch Jr.
       [not found]     ` <EDC8DDD212FEB34C884CBB0EE8EC2D91081F698E@namailgen.corp.adobe.com>
  0 siblings, 1 reply; 6+ messages in thread
From: David H. Lynch Jr. @ 2008-02-01  7:54 UTC (permalink / raw)
  To: gcc-help

Philipp Thomas wrote:
>> -fms-extensions
>>     
>
> BTW on a side note: If at all possible, get rid of that option (i.e.
> change the code that needs it), because it allows IMNSHO very dubious MS
> extensions to C++.
    My goal - once things work is compilation without warnings on all
supported platforms,
    with minimal sabatoging of warnings or errors with compiler options.

    But the first thing I need to do is isolate the actual problem.  


    I have tried a couple of things, and I am getting nowhere.
    I have added the -fms-extensions compile option - with no effect.
    I have eliminated the inherited parent class from the class definition
    - with no effect.
    I am dealing with enough complexity that I may have screwed up some
    of my efforts to try to isolate this.
     I did manage to eliminate a few undefined vtable messages - but
that was by eliminating
    all references to that class.
    There must be some what to try to isolate or zero in on this.

    Other suggestions for techniques to zero in on this problem would be
greatly appreciated.  




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to vtable for xxx
       [not found]     ` <EDC8DDD212FEB34C884CBB0EE8EC2D91081F698E@namailgen.corp.adobe.com>
@ 2008-02-01 14:52       ` David H. Lynch Jr.
  2008-02-02  9:06         ` Philipp Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: David H. Lynch Jr. @ 2008-02-01 14:52 UTC (permalink / raw)
  To: gcc-help

John (Eljay) Love-Jensen wrote:
> Hi David,
>
> Here's example code which intentionally fails to generate a vtable.  See below.
>
> Maybe that will help you diagnose your issue.
I appreciate everyones help. I finally found the problem - though I
still do not mostly understand it.

The header files for the classes with the problems contained
#pragma interface "xxx.h"
but the source files for those classes did not contain
#pragma implementation "xxx.h"

Either eliminating the #pragma interface instances or adding the #pragma
imlementation
corrected the problem.
I have not been able to find any reason one would need either pragma
with current versions of
gcc.

Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to vtable for xxx
  2008-02-01 14:52       ` David H. Lynch Jr.
@ 2008-02-02  9:06         ` Philipp Thomas
  0 siblings, 0 replies; 6+ messages in thread
From: Philipp Thomas @ 2008-02-02  9:06 UTC (permalink / raw)
  To: gcc-help

On Fri, 01 Feb 2008 09:51:49 -0500, David H. Lynch Jr. wrote:

>I have not been able to find any reason one would need either pragma
>with current versions of gcc.

Those two pragmas stem from ancient pre-ISO C++ times and are indeed
unneedeed. If gcc only sees '#pragma interface' , it thinks everything
is a definition of the interface and will not create vtables.

Philipp

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-02  9:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-28 18:57 undefined reference to vtable for xxx David H. Lynch Jr.
2008-01-29  0:47 ` Rüdiger Ranft
2008-01-29  1:31 ` Philipp Thomas
2008-02-01  7:54   ` David H. Lynch Jr.
     [not found]     ` <EDC8DDD212FEB34C884CBB0EE8EC2D91081F698E@namailgen.corp.adobe.com>
2008-02-01 14:52       ` David H. Lynch Jr.
2008-02-02  9:06         ` Philipp Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).