[C++-sig] [boost.python] Can't import a wrapped template class

Stefan Seefeld stefan at seefeld.name
Fri Oct 26 19:59:25 CEST 2012


On 10/26/2012 01:50 PM, Paul O. Seidon wrote:
> The ctor is decl'ed in varbls.h as
>
> _Variable();
>
> and it's def'ed in varbls.cpp like so:
>
> template <typename TYPE>
> _Variable<TYPE>::_Variable()
> : _value( 0)
> {
>      //ctor
> }

That doesn't work. When the compiler compiles varbls.cpp, it doesn't
know what types to instantiate the _Variable template for, so you need
to either explicitly instantiate it for all the types you use in your
module, or keep the definitions in the varbls.h header so the compiler
can implicitly instantiate them when compiling the Python module.

    Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list