info-inventor
[Top] [All Lists]

Re: Strange behavior of SoXt:init or am I missing something?

To: haykel@xxxxxxxxxxxxxxx (Haykel ben Jemia)
Subject: Re: Strange behavior of SoXt:init or am I missing something?
From: jlim@xxxxxxxxxxxxxxxxxxxx (Jonathan Lim)
Date: Wed, 8 Nov 2000 18:23:54 -0800 (PST)
Cc: info-inventor@xxxxxxxxxxx
In-reply-to: <20001104223352.A22278@xxxxxxxxxxxxxxxxxxxxx> from "Haykel ben Jemia" at Nov 04, 2000 10:33:52 PM
Sender: owner-inventor@xxxxxxxxxxx
This appears to be a DSO loading weirdness. I was able to reproduce the problem
on Red Hat 6.2. Note that if a Motif function is called at the outset, the
error does not appear, e.g. insert XmStringCreateSimple("") before appContext
is declared. Also, the DSO's included in the RPM's are linked against the Motif
1.x DSO (libXm.so.1). Linking against the Motif 2.x DSO (libXm.so.2) will
probably result in a runtime error.


              Jonathan Lim  _  Silicon Graphics  _  Mountain View
              GPS Graphics     Computer Systems        CA, USA


On Sat Nov  4 13:33:52 2000, haykel@xxxxxxxxxxxxxxx wrote:
> 
> Hi,
> I'm learning to program with X Windows and OpenInventor and I encountered the
> following problem:
>  * the following test programs test1 and test2 both compile, but while test2
> is working fine, I receive the following error message with test1:
> 
> Error: attempt to add non-widget child "DropSiteManager" to parent "test1" 
> which supports only widgets
> 
>  * I noticed after some experiments that I can make test1 work if I add a
> widget library to link the program with when compiling (like: -lXm, -lXaw or
> -lXaw3d), without even changing the code. Is this normal?? Why is test2
> working even if I don't link with one of these widget libs?? Why is the code
> compiling if one of these libraries is needed??
> 
> And what I REALLY DON'T understand is: AREN'T BOTH PROGRMAS DOING EXACTLY THE
> SAME THING???
> 
> My System:
> Linux Mandrake 7.2 RC-1
> Kernel: 2.2.17-21mdk
> Inventor: sgi-OpenInventor-devel-2.1.5-6.i386.rpm
> X Server: XFree86-server-4.0.1-26mdk
> Graphics chip: NVIDIA TNT2
> 
> --------------------- test1 -----------------------------
> #include <iostream.h>
> #include <Inventor/Xt/SoXt.h>
> #include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
> #include <Inventor/nodes/SoCone.h>
> 
> int main(int argc, char *argv[]) {
>   XtAppContext appContext;
> 
>   cout << "Test 1: XtAppInitialize + SoXt::init(widget)" << endl;
> 
>   Widget mainApp = XtAppInitialize(&appContext,
>                                  "TestClass",
>                                  NULL, 0,
>                                  (int *) &argc, argv,
>                                  NULL,
>                                  NULL ,0);
>   SoXt::init(mainApp);
> 
>   SoXtExaminerViewer *view = new SoXtExaminerViewer(mainApp);
>   view->setSceneGraph(new SoCone);
>   view->show();
> 
>   SoXt::show(mainApp);
> 
>   SoXt::mainLoop();
>   return 0;
> }
> --------------------- test1 -----------------------------
> 
> --------------------- test2 -----------------------------
> #include <iostream.h>
> #include <Inventor/Xt/SoXt.h>
> #include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
> #include <Inventor/nodes/SoCone.h>
> 
> int main(int argc, char *argv[]) {
> 
>   cout << "Test 2: SoXt::init(argv[0]) only" << endl;
> 
>   Widget mainApp = SoXt::init(argv[0], "TestClass");
> 
>   SoXtExaminerViewer *view = new SoXtExaminerViewer(mainApp);
>   view->setSceneGraph(new SoCone);
>   view->show();
> 
>   SoXt::show(mainApp);
> 
>   SoXt::mainLoop();
>   return 0;
> }
> --------------------- test2 -----------------------------
> 
> --------------------- Makefile --------------------------
> all: test1 test2
> 
> test1: test1.c++
>       g++ -o test1 test1.c++ -I/usr/X11R6/include -lInventorXt \
> #     -L/usr/X11R6/lib -lXaw
> # Uncomment the line above to make test1 work! Why ????
> 
> test2: test2.c++
>       g++ -o test2 test2.c++ -I/usr/X11R6/include -lInventorXt
> # test2 doesn't need such a line!!
> --------------------- Makefile --------------------------

<Prev in Thread] Current Thread [Next in Thread>