Results 1 to 6 of 6

Thread: [SOLVED] Getting the packages for Motif/X11 to compile

  1. #1
    Join Date
    Sep 2007
    Beans
    54
    Distro
    Ubuntu 10.04 Lucid Lynx

    [SOLVED] Getting the packages for Motif/X11 to compile

    Hi, I'm trying to get all the stuff I need to do Motif development for school. This is the program im trying to compile
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <Xm/Xm.h>
    #include <Xm/Label.h>
    
    /* Xt part of the X Toolkit */
    XtAppContext context;
    /* Xm part of Motif */ 
    
    XmStringCharSet char_set = XmSTRING_DEFAULT_CHARSET;
    Widget toplevel, label;
    int main(int argc, char* argv[]){
      Arg al[10]; /* argument list */
      int ac;	/* argument counter */
    
      /* Creat the toplevel shell */
      toplevel = XtAppInitialize(&context,"XmLabelDemo",NULL,0,&argc,argv,NULL,NULL,0);
      /*  Create label widget*/
      ac = 0;
      XtSetArg(al[ac],XmNlabelString,XmStringCreateLtoR("Hello World", char_set));
      ac++;
      label = XmCreateLabel(toplevel,"label",al,ac);
      XtManagerChild(label);
      XtRealizeWidget(toplevel);
      XtAppMainLoop(context);
      exit(EXIT_SUCCESS);
    }
    This compiles in my classroom computer.

    I installed alot of packages that had motif or X11 in the name and from going to over a couple hundred errors, im down to 2.

    Code:
    gcc label.c 
    In file included from label.c:3:
    /usr/include/Xm/Xm.h:59:34: error: X11/extensions/Print.h: No such file or directory
    In file included from label.c:3:
    /usr/include/Xm/Xm.h:827: error: expected specifier-qualifier-list before ‘XPContext’
    Could someone help me clear up these errors. Thanks

    Brian

  2. #2
    Join Date
    Oct 2007
    Location
    Fort Collins, CO, USA
    Beans
    480
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Getting the packages for Motif/X11 to compile

    You can search for missing header files using the apt-get package and command.
    Code:
    $ sudo apt-get install apt-file
    $ sudo apt-file update
    $ apt-file search X11/extensions/Print.h
    x11proto-print-dev: usr/include/X11/extensions/Print.h
    X11/extensions/Print.h is in the x11proto-print-dev package.

  3. #3
    Join Date
    Sep 2007
    Beans
    54
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Getting the packages for Motif/X11 to compile

    Thanks stroyan,
    That did get me the header file I was after.

    Now, when I compile with...
    Code:
    gcc -o label label.c -lXm -lXt -lX11
    I get an error,
    Code:
    /tmp/ccWcYiQW.o: In function `main':
    label.c:(.text+0xc6): undefined reference to `XtManagerChild'
    collect2: ld returned 1 exit status
    I dont know what other lib I have to link, and some webpages I found told to like the three libs I did above. Any help is appreciated.

    Thanks,
    Brian

  4. #4
    Join Date
    Sep 2005
    Location
    Crevillent (Alicante), Sp
    Beans
    69
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Getting the packages for Motif/X11 to compile

    After a little googling, and knowing absolutely nothing about motif or x, I would say that the function you want to use is "XtManageChild" and not "XtManagerChild".

  5. #5
    Join Date
    Mar 2006
    Location
    Eefde, The Netherlands
    Beans
    432
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Getting the packages for Motif/X11 to compile

    Don't know much about X11 development, but looking at the man-pages, there is no XtManagerChild() function, there is, however, an XtManageChild() function.
    Perhaps a little typo?
    "When in doubt, use brute force."

    -- Ken Thompson

  6. #6
    Join Date
    Sep 2007
    Beans
    54
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Getting the packages for Motif/X11 to compile

    That was the problem! I probably did typo after pulling it off my prof's website and playing around with it.
    heh, I should try to troubleshoot more!

    Thanks alot guys (or gals!)

    brian

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •