[EMAIL PROTECTED],
  In a message on 21 Apr 2006 02:13:10 -0700, wrote :

S> Hi all,
S> 
S> I'm having a problem with a shared object i've written. I have a class
S> with a couple of private static data members.
S> The class declaration is in a .h file and the member function
S> definitions are in a .cpp file.
S> 
S> I'm compiling the shared object with -fPIC and -shared.
S> 
S> The code compiles fine, but when I try to use the shared object, I get
S> a linker error saying  undefined reference to `CSomeClass::m_SomeVar'
S> where m_SomeVar is the private static member.
S> The same is hapning for the other static memver variables as well.
S> 
S> Is there some issue with using static data members in shared objects ?

No.  In addition to *declaring* the static members in the header (.h),
you need to properly *define* them in *one* .cpp file.  What exactly
do your definitions look like?  Are *exactly* how are you linking the
shared library?  You should post actual code (or code fragments) AND
possibly parts of your Makefile(.in,.am) (you are using a Makefile?)

S> 
S>                            

Robert Heller             -- 978-544-6933
Deepwoods Software        -- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
[EMAIL PROTECTED]       -- Contract Programming: C/C++, Tcl/Tk






                                                                
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to