[C++-sig] tutorial class_data_members compile problem

=?X-UNKNOWN?Q?Christian_H=F6ppler?= hoeppler at diener.iap.physik.uni-tuebingen.de
Tue Oct 15 13:08:15 CEST 2002


Hi,

Being new to boost::python, I've just tried to build the class Var of the
tutorial class_data_members.html.  However, I get the attached errors
unless I remove the 'const' access modifier from its member variable
'name'.  In that case everything works just fine.

What is the problem?

Thanks, Chris.

(system: gcc version 2.95.3 20010315 (SuSE), Python 2.2.1, boost_1_29_0)


~/boost_1_29_0/tools/build/jam_src/bin.linuxx86/bjam "-sTOOLS=gcc"
...found 1782 targets...
...updating 2 targets...
gcc-C++-action ../../../libs/python/my_project/bin/hello.so/gcc/debug/runtime-link-dynamic/shared-linkable-true/hello.o
/home/hoeppler/boost_1_29_0/boost/python/data_members.hpp: In function `static struct PyObject * boost::python::detail::member<const basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,Var,boost::python::return_value_policy<boost::python::copy_non_const_reference,boost::python::default_call_policies> >::get(const string Var::*, PyObject *, PyObject *, const boost::python::return_value_policy<boost::python::copy_non_const_reference,boost::python::default_call_policies> &)':
/home/hoeppler/boost_1_29_0/boost/python/data_members.hpp:74:   instantiated from `boost::python::make_getter<Var, const string>(const string Var::*)'
/home/hoeppler/boost_1_29_0/boost/python/class.hpp:262:   instantiated from here/home/hoeppler/boost_1_29_0/boost/python/data_members.hpp:34: aggregate `struct boost::python::detail::copy_non_const_reference_expects_a_non_const_reference_return_type<const basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > &> cr' has incomplete type and cannot be initialized
/home/hoeppler/boost_1_29_0/boost/python/data_members.hpp:74:   instantiated from `boost::python::make_getter<Var, const string>(const string Var::*)'
/home/hoeppler/boost_1_29_0/boost/python/class.hpp:262:   instantiated from here
/home/hoeppler/boost_1_29_0/boost/python/data_members.hpp:39: `cr' cannot be used as a function

    g++  -c -Wall -ftemplate-depth-100  -DBOOST_PYTHON_DYNAMIC_LIB  -g -O0 -fno-inline -fPIC   -I"../../../libs/python/my_project"  -isystem "/usr/local/include/python2.2" -isystem "/home/hoeppler/boost_1_29_0"  -o "../../../libs/python/my_project/bin/hello.so/gcc/debug/runtime-link-dynamic/shared-linkable-true/hello.o"  "hello.cpp"

    ...failed gcc-C++-action ../../../libs/python/my_project/bin/hello.so/gcc/debug/runtime-link-dynamic/shared-linkable-true/hello.o...
    ...skipped <libs!python!my_project/hello.so/gcc/debug/runtime-link-dynamic/shared-linkable-true>hello.so for lack of <libs!python!my_project/hello.so/gcc/debug/runtime-link-dynamic/shared-linkable-true>hello.o...
    ...failed updating 1 target...
    ...skipped 1 target...





More information about the Cplusplus-sig mailing list