I'm trying to use the new serialization support and getting a compile error I 
don't really understand.
For the following code:
---------------------------------------------------------------------------------
class Foo : public osg::Group {
public:
    Foo() {}
    void setNote(std::string &s) { _note = s; }
    const std::string  & getNote() const { return _note; }
    void setNumber(int n) { _num = n; }
    const int getNumber() const { return _num; }
private:
    std::string _note;
    int _num;
};


REGISTER_OBJECT_WRAPPER( Foo,
                         new Foo,
                         Foo,
                         "osg::Object osg::Node osg::Group Foo" )
{
    ADD_STRING_SERIALIZER(Note, "v");
    ADD_INT_SERIALIZER(Number, 0);
}
---------------------------------------------------------------------------------
I get the following compile-time error:

g++ -DDarwin  -g -ggdb3 -32 -m32 -I. -I/usr/local/include -c -o obj/multiTree.o 
./multiTree.cpp
./multiTree.cpp: In function 'void wrapper_propfunc_Foo(osgDB::ObjectWrapper*)':
./multiTree.cpp:42: error: no matching function for call to 
'osgDB::StringSerializer<Foo>::StringSerializer(const char [5], const char [2], 
const std::string& (Foo::*)()const, void (Foo::*)(std::string&))'
/usr/local/include/osgDB/Serializer:425: note: candidates are: 
osgDB::StringSerializer<C>::StringSerializer(const char*, const std::string&, 
const std::string& (C::*)()const, void (C::*)(const std::string&)) [with C = 
Foo]
/usr/local/include/osgDB/Serializer:419: note:                 
osgDB::StringSerializer<Foo>::StringSerializer(const 
osgDB::StringSerializer<Foo>&)
./multiTree.cpp:43: error: no matching function for call to 
'osgDB::PropByValSerializer<Foo, int>::PropByValSerializer(const char [7], int, 
const int (Foo::*)()const, void (Foo::*)(int))'
/usr/local/include/osgDB/Serializer:205: note: candidates are: 
osgDB::PropByValSerializer<C, P>::PropByValSerializer(const char*, P, P 
(C::*)()const, void (C::*)(P), bool) [with C = Foo, P = int]
/usr/local/include/osgDB/Serializer:199: note:                 
osgDB::PropByValSerializer<Foo, int>::PropByValSerializer(const 
osgDB::PropByValSerializer<Foo, int>&)
make: *** [obj/multiTree.o] Error 1

If I comment out the REGISTER_OBJECT_WRAPPER macro use, the code compiles 
without problem.
Clearly this macro is working fine for the OSG library code, so I'm sure it's 
my mistake.  I just can't decipher the error message to know what to fix.  Can 
someone give me the clue as to what I'm doing wrong?

Lee
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to