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

Cyril Bonnard cyril.bonnard at cirad.fr
Mon May 19 12:04:29 CEST 2003


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*)



code is:
appe_color.cpp:
...
BOOST_PYTHON_MODULE(appe_color)
{
    class_< Color3 >("Color3", init< const Color3 & >())
        .def(init< unsigned char, unsigned char, unsigned char >())
        .def(init< optional< unsigned char > >())
        .def(init< const unsigned char * >())
 
        .def_readonly("BLACK", &Color3::BLACK)   // line 17
...

appe_color.h:
...
class GEOM_API Color3 : public TOOLS(Tuple3)<uchar>
//class Color3 : public UCharTuple3
{

  friend class Color4;

public:

  /// The black color.
  static const Color3 BLACK;
...

2///
I also get a problem with constructor of class Color4: the pb is that 
one of the constructor seems to not match one of the 4 defined constructors,

appe_color.cpp:42:call of overloaded `Color4(unsigned char&)' is ambiguous
/home/cbonnard/devlp/AMAPmod/src/GEOM/appe_color.h:157: candidates are: 
Color4::Color4(const Color4&) <near match>
/home/cbonnard/devlp/AMAPmod/src/GEOM/appe_color.h:168:                 
Color4::Color4(const uchar*) <near match>
/home/cbonnard/devlp/AMAPmod/src/GEOM/appe_color.h:165:                 
Color4::Color4(unsigned char)
/home/cbonnard/devlp/AMAPmod/src/GEOM/appe_color.h:162:                 
Color4::Color4(unsigned char = 255, unsigned char = 255, unsigned char = 
255, unsigned char = 0)

appe_color.cpp:
    class_< Color4 >("Color4", init< const Color4 & >())
        .def(init< optional< unsigned char, unsigned char, unsigned 
char, unsigned char > >())
        .def(init< unsigned char >())                                   
                                                              // line 
42: the one that should be recognized
        .def(init< const unsigned char * >())
        .def(init< const Color3 &, unsigned char >())

appe_color.h:
  explicit Color4( uchar r = 255, uchar g = 255, uchar b = 255, uchar a 
= 0 ) ;
  explicit Color4( uchar v );
               Color4( const uchar * rgba );
               Color4( const Color3& c, uchar alpha );










More information about the Cplusplus-sig mailing list