You need to run osginit() before creating any containers.
Cheers,
/Marcus
Sajjadul Islam wrote:
> Hello,
>
> Are the code snippet given in the wiki supposed to function within
> simple int main() { return0 ; } block?
>
> The code taken from that is compiling fine, but getting segmentation
> fault!!!!!!
>
> Please explain to me if i am missing the whole logic of the scenegraph
> architechture.
>
>
> THE CODE SNIPPET
>
> ***************************************************
>
> //Basic contains the common headers neeeded by the scenegraph
> #include "Basic.h"
>
>
> int main()
> {
> NodePtr grandpa = Node::create();
> NodePtr aunt = Node::create();
> NodePtr mother = Node::create();
> NodePtr me = Node::create();
>
>
> setName(grandpa, "Grandpa");
> setName(aunt, "Aunt");
> setName(mother, "Mother");
> setName(me, "Me");
>
>
>
>
> beginEditCP(grandpa);
> grandpa->addChild(aunt);
> grandpa->addChild(mother);
> endEditCP(grandpa);
>
> beginEditCP(mother);
> mother->addChild(me);
> endEditCP(mother);
>
>
> NodePtr n ;
>
> n = me->getParent()->getParent();
>
>
> cout << "Grandpa has" << grandpa->getNChildren() << "children." << endl;
>
> n = grandpa->getChild(0);
> n = grandpa->getChild(1);
>
>
> return 0;
> }
>
>
> *****************THE ERROR WHILE RUNNING*****************'
>
> [EMAIL PROTECTED]:~/openSG/opSG/test$ make testOSG
> g++ -D_GNU_SOURCE -DQT_CLEAN_NAMESPACE -DOSG_WITH_GLUT -DOSG_WITH_QT
> -DOSG_WITH_TIF -DOSG_WITH_JPG -DOSG_WITH_PNG -D_OSG_HAVE_CONFIGURED_H_
> -DQT_NO_XINERAMA -DQT_NO_XRENDER -DQT_NO_XFTFREETYPE -DQT_NO_XKB
> -DQT_NO_SM_SUPPORT -DQT_NO_IMAGEIO_MNG -DQT_NO_IMAGEIO_JPEG
> -DQT_NO_STYLE_AQUA -DQT_NO_STYLE_MAC -DQT_NO_STYLE_INTERLACE
> -DQT_NO_STYLE_COMPACT -ansi -use_readonly_const -ftemplate-depth-100
> -fPIC -O3 -DOSG_WITH_GLUT -DOSG_WITH_TIF -DOSG_WITH_JPG -DOSG_WITH_PNG
> -I/usr/include/ -I/usr/include/ -I/usr/include/ -I/usr/include/GL/
> -I/usr/local/include -c testOSG.cpp
> g++ -o testOSG testOSG.o -O2 -L/usr/lib/ -L/usr/lib/ -L/usr/lib/
> -L/usr/lib/ -L/usr/local/lib/opt -lOSGWindowGLUT -lOSGSystem -lOSGBase
> -ltiff -ljpeg -lpng -lz -lglut -lGLU -lGL -lXmu -lXi -lXt -lX11
> -lpthread -ldl -lm -L/usr/X11R6/lib64
> [EMAIL PROTECTED]:~/openSG/opSG/test$ ./testOSG
> FATAL: setName: no container?!?
> FATAL: setName: no container?!?
> FATAL: setName: no container?!?
> FATAL: setName: no container?!?
> Segmentation fault (core dumped)
>
>
>
> -------------------------------------------------------------------------
> 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
-------------------------------------------------------------------------
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