shared library - undefined symbols

Andrew Haley aph@redhat.com
Thu Dec 7 09:46:00 GMT 2006


Anitha Boyapati writes:
 > 
 > On Wed, 6 Dec 2006, Andrew Haley wrote:
 > 
 > > Anitha Boyapati writes:
 > >  > 
 > >  >  Please let me know if I am missing something.It is important for
 > >  >  me to get through this immediately :-(
 > >  > 
 > >  >  -------------------------------------------
 > >  > 
 > >  >  Sample Code :
 > >  > 
 > >  > 	class X : class baseX {
 > >  > 	...
 > >  > 	};
 > >  > 
 > >  > 	class Y : class baseY {
 > >  > 	...
 > >  > 	};
 > >  > //End of Code
 > >  > 
 > >  >  g++ -c -shared -o mem.so X.o Y.o
 > >  > 
 > >  >  ( This created mem.so )
 > >  > 
 > >  >  When used with dlopen as :
 > >  > 
 > >  >  handle = dlopen ("mem.so", RTLD_LAZY)
 > >  >  
 > >  >  The above statement throws error saying undefined reference to baseX
 > >  >  and BaseY!	
 > > 
 > > No kidding.  Where are baseX and BaseY defined?
 > 
 >  They are also included while building mem.so.But I got the mistake.
 >  I didnt define the virtual methods declared in X and Y out of pure 
 >  ignorance :-)
 > 
 >  Doesnt it sound right if we have some error or warning thrown for such 
 >  cases where definitions are not found while building a shared library?

Why?  They might be defined in some other library.

Andrew.



More information about the Gcc-help mailing list