How to compile this code implementing Xm on Ubuntu 64 bit using Netbeans?
I am just new to X-Windows and trying to code that just calls simple
MessageBox on Linux like Window's.
I am on Ubuntu 12.04LTS 64bit and installed Netbeans full version. I
included "/usr/include/Xm" to this project, and for libs, I included
"Motif" libs.
and following error occurs when I compile the code:
main.cpp:24:63: error: invalid conversion from 'void (*)(Widget,
XtPointer, XmPushButtonCallbackStruct*) {aka void (*)(_WidgetRec*, void*,
XmPushButtonCallbackStruct*)}' to 'XtCallbackProc {aka void
(*)(_WidgetRec*, void*, void*)}' [-fpermissive]
/usr/include/X11/Intrinsic.h:1241:13: error: initializing argument 3 of
'void XtAddCallback(Widget, const char*, XtCallbackProc, XtPointer)'
[-fpermissive]
I really do not understand this error, at least I have never seen syntax
like, "aka void blah blah~~".
Can anyone please help me fix this compile error and, if possible, please
explain me what this error message mean?
Here is original source code:
#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");
}
No comments:
Post a Comment