Hello Sajjadul,

Sajjadul Islam wrote:
> I am attaching a small snippet of code showing one of the probable usage
> of FieldContainer that is taken from the starter guide.
> 
> But i am getting error
> Could you point out my mistake as the error script saying as follows:
> 
> firstOSG.cpp: In function ‘int main(int, char**)’:
> firstOSG.cpp:94: error: ‘class osg::Node’ has no member named ‘getChildren’
> firstOSG.cpp:96: error: ‘class osg::Node’ has no member named ‘getChildren’
> firstOSG.cpp:99: error: ‘class osg::Node’ has no member named ‘getChildren’
> make: *** [firstOSG.o] Error 1
> 
> i m just copying the code from the guide, and need to understand what is
> it doing?

the starter guide apparently and unfortunately shows buggy code in this
case. You are probably better off by starting from one of the tutorials
(OpenSG/Tutorials in a cvs checkout), because these are regularly
compiled, so they will most likely work.
Anyway, the correct code for the respective lines is:

94:
cout << "Grandpa has " << grandpa->getNChildren() << " children.";

96:
n = grandpa->getChild(0);

98:
n = grandpa->getChild(1);

Some more background: The Node does not give access to children field,
because adding a child to a Node will also cause the Node to be recorded
as parent of that child. To make sure this happens you can not access
the field directly but have to go through a set of member functions (See
the file OpenSG/Source/System/FieldContainer/Impl/OSGNodeImpl.h which
contains the definition of class Node).

        Hope it helps,
                Carsten

PS: I'll fix the starter guide, thanks for reporting the problem.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to