simple X window program not compile, plz help

eric lin fsshl at luxmail.com
Sun Oct 31 17:41:30 PDT 2010


Dear X window advanced programers:

  on my ubuntu/linux, I tried a simple x window program by c
as following:

---------------------------------------

#include <stdlib.h>
#include <stdio.h>
#include <X11/Intrinsic.h> /* for creation routines */
#include <X11/StringDefs.h>    /* for resource names */
#include <X11/Xaw/Form.h>      /* to define the formWidgetClass  */

int main()
{
   XtAppContext appContext;
   Widget toplevel, form;

   toplevel = XtVaAppInitialize( &appContext, 
                                 "2D-Editor", /* Application class name   */
                                 NULL, 0, /* option list (not used)
                                 &argc, argv, /* command line parameters */
                                 NULL,     /* fallback resources (not
                                              used)                      */
                                 NULL      /* end of the variable
                                              argument list              */
                                , 0);

    if (toplevel == NULL) {
       fprintf(stderr, "Failed to connect to X server!" );
       exit(1);
    }
   return (0);
}

---------------------------------------------------------------
this is I copy from page 146 and page 150 of book "X Window Programming from SCRATCH"

----------------
eric at eric-laptop:~$ gcc try2.c
try2.c: In function ‘main’:
try2.c:20: warning: not enough variable arguments to fit a sentinel
/tmp/cc06w66r.o: In function `main':
try2.c:(.text+0x41): undefined reference to `XtVaAppInitialize'
collect2: ld returned 1 exit status
eric at eric-laptop:~$ 
--------------------------------------------------------------------
I read man page about XtVaAppinitialize, that's why I add 0 as last argument in parameter of it, otherwise just follow that book's listing, g++ will claim it is too few parameter
but it still not work
plz help
thx in advance for your time and patience, Eric

_____________________________________________________________
Luxmail.com is spam free. However, we do not throw your important emails into spam box like other defective email systems.


More information about the xorg mailing list