[C++-sig] [Py++] Undefined symbols for static const int member of class

Brian O'Kennedy brokenn at gmail.com
Fri May 21 12:05:31 CEST 2010


I'm wrapping a very simple class using PyPlusPlus.

---- snip ----
 class testclass
   static const int a = 99;
---- /snip ----

And Py++ exposes the static member with a def_readonly("a", testclass::a )
call. When I import this module into python I get an undefined symbol for

  ImportError: ./testwrapper.so: undefined symbol: _ZN9testclass1aE

I understand that the static member has no storage and thus boost python
cannot find the address of it. However, I was hoping there is a way to solve
this kind of (common?) problem using Py++ to perhaps generate a getter
function or something similar. How would one do this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20100521/aea87aaf/attachment.html>

More information about the Cplusplus-sig mailing list