[C++-sig] Re: no matching function for call

David Abrahams dave at boost-consulting.com
Thu May 22 17:41:03 CEST 2003


Cyril Bonnard <cyril.bonnard at cirad.fr> writes:

> David Abrahams wrote:
>
>>Cyril Bonnard <cyril.bonnard at cirad.fr> writes:
>>
>>  
>>>If someone could help me on theses errors.......
>>>
>>>1///
>>>I just can't explain why the following code (line 17) doesn't work fine:
>>>
>>>error is:
>>>appe_color.cpp: In function `void init_module_appe_color()':
>>>appe_color.cpp:17: no matching function for call to
>>>boost::python::class_<Color3, boost::python::detail::not_specified,
>>>boost::python::detail::not_specified,
>>>boost::python::detail::not_specified>::def_readonly(const char[6],
>>>const Color3*)
>>>
>>>    
>>
>>I think this one is fixed now.  Please try the latest CVS.
>>
>>  
> i am sorry i've done a cvs update an try it again:
> ...
>  .def_readonly("BLACK", &Color3::BLACK) //line 17
> ...
>
> appe_color.cpp:17: no matching function for call to
> boost::python::class_<Color3, boost::python::detail::not_specified,
> boost::python::detail::not_specified,
> boost::python::detail::not_specified>::def_readonly(const char[6],
> const Color3*)'
> scons: *** [appe_color.os] Error 1
> scons: done building targets.


Please (always when asking for help) post a small, complete,
reproducible test case which shows what you expect to work and what
you expect the results to be.  Trying to extrapolate from what you've
supplied is not working out for me.  The following compiles with the
current CVS state:

    #include <boost/python.hpp>

    using namespace boost::python;

    struct Color3
    {

      static const Color3 BLACK;
    };

    BOOST_PYTHON_MODULE(foo_ext)
    {
        class_< Color3 >("Color3", init< const Color3 & >())
            .def_readonly("BLACK", &Color3::BLACK)   // line 17
            ;
    }


-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list