simple motif program fail to compile, plz help

Christopher Chan christopher.chan at bradbury.edu.hk
Thu Nov 4 13:08:38 UTC 2010


apt-file -x search X11/extensions/Print.h
output: x11proto-print-dev: /usr/include/X11/extensions/Print.h

apt-get install x11proto-print-dev

On Thursday, November 04, 2010 03:50 PM, eric lin wrote:
> dear Kassube at gmx dot net:
>
>    by your help, my gcc can recognize some of motif lib file, like Xm.h
>   But I still still some help.  Since my motif program still not compile under gcc 4.4.3
> this motif filed is I copy from web, (I just do google search)
> --------------------------------------------------
>
> #include<Xm/Xm.h>
> #include<Xm/PushB.h>
>
> /* Prototype Callback function */
>
> void pushed_fn(Widget , XtPointer ,
>                 XmPushButtonCallbackStruct *);
>
>
> main(int argc, char **argv)
>
> {   Widget top_wid, button;
>      XtAppContext  app;
>
>      top_wid = XtVaAppInitialize(&app, "Push", NULL, 0,
>          &argc, argv, NULL, NULL);
>
>      button = XmCreatePushButton(top_wid, "Push_me", NULL, 0);
>
>      /* tell Xt to manage button */
> 				XtManageChild(button);
>
> 				/* attach fn to widget */
>      XtAddCallback(button, XmNactivateCallback, pushed_fn, NULL);
>
>      XtRealizeWidget(top_wid); /* display widget hierarchy */
>      XtAppMainLoop(app); /* enter processing loop */
>
> }
>
> void pushed_fn(Widget w, XtPointer client_data,
>                 XmPushButtonCallbackStruct *cbs)
>    {
>       printf("Don't Push Me!!\n");
>    }
> -------------------And my compile result is--------------------------------------
> root at eric-laptop:/home/eric# gcc tmotif1.c
> In file included from tmotif1.c:2:
> /usr/include/Xm/Xm.h:59:34: error: X11/extensions/Print.h: No such file or directory
> In file included from tmotif1.c:2:
> /usr/include/Xm/Xm.h:827: error: expected specifier-qualifier-list before ‘XPContext’
> tmotif1.c: In function ‘main’:
> tmotif1.c:25: warning: passing argument 3 of ‘XtAddCallback’ from incompatible pointer type
> /usr/include/X11/Intrinsic.h:1244: note: expected ‘XtCallbackProc’ but argument is of type ‘void (*)(struct _WidgetRec *, void *, struct XmPushButtonCallbackStruct *)’
> tmotif1.c: In function ‘pushed_fn’:
> tmotif1.c:35: warning: incompatible implicit declaration of built-in function ‘printf’
> root at eric-laptop:/home/eric#
> ------------------------------plz help---------------------------------------------
>
>
> ----------------
> --- kassube at gmx.net wrote:
>
> From: Nils Kassube<kassube at gmx.net>
> To: ubuntu-users at lists.ubuntu.com
> Subject: Re: why after I atp-get install motif-clients, still no Xm/Xm.h file?
> Date: Thu, 4 Nov 2010 07:33:56 +0100
>
> eric lin wrote:
>> actually do anyone know where is motif (x window widget-gadgets) go
>> after I do root at eric-laptop:/home/eric# apt-get install motif
>
> According to the subject you are looking for the motif header files.
> They are not needed to run applications but only if you want to compile
> something which wants to include the motif library. The header files are
> therefore part of the development package "libmotif-dev".
>
>
> Nils
>





More information about the ubuntu-users mailing list