undefined reference to vtable

Shaun Jackman sjackman@telus.net
Wed Aug 11 01:16:00 GMT 2004


On Tue August 10, 2004 13h35, Bryce McKinlay wrote:
> Shaun,
> 
> You need to either:
> 
> - add "-lgcj" to your link command, or
> - Use "gcj" to link, not "g++"
> 
> Regards
> 
> Bryce

I tried both suggestions without success. If I remove every reference
to ShellSelectionListener, it links just fine with my original command
line. I believe I'm missing something in my definition of
ShellSelectionListener.

Thanks,
Shaun


sjackman@quince ~/work/hello/swt-cni$ g++-3.4  -g -O2   -o HelloWorld  HelloWorld.o -lswt -lswt-pi -lgcj
HelloWorld.o(.text+0x136): In function `main':
/home/sjackman/work/hello/swt-cni/HelloWorld.cc:62: undefined reference to `java::lang::Object::Object()'
HelloWorld.o(.text+0x13e):/home/sjackman/work/hello/swt-cni/HelloWorld.cc:62: undefined reference to `vtable for ShellSelectionListener'
collect2: ld returned 1 exit status

sjackman@quince ~/work/hello/swt-cni$ gcj-3.4  -g -O2   -o HelloWorld  HelloWorld.o -lswt -lswt-pi
HelloWorld.o(.text+0x136): In function `main':
/home/sjackman/work/hello/swt-cni/HelloWorld.cc:62: undefined reference to `java::lang::Object::Object()'
HelloWorld.o(.text+0x13e):/home/sjackman/work/hello/swt-cni/HelloWorld.cc:62: undefined reference to `vtable for ShellSelectionListener'
collect2: ld returned 1 exit status



More information about the Java mailing list