linux - How to compile this code implementing Xm on Ubuntu 64 bit using Netbeans? -
i new x-windows , trying code calls simple messagebox on linux window's.
i on ubuntu 12.04lts 64bit , installed netbeans full version. included "/usr/include/xm" project, , libs, included "motif" libs.
and following error occurs when compile code:
main.cpp:24:63: error: invalid conversion ‘void (*)(widget, xtpointer, xmpushbuttoncallbackstruct*) {aka void (*)(_widgetrec*, void*, xmpushbuttoncallbackstruct*)}’ ‘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 not understand error, @ least have never seen syntax like, "aka void blah blah~~".
can please me fix compile error and, if possible, please explain me error message mean?
here 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 manage button */ xtmanagechild(button); /* attach fn 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"); }
xtaddcallback
expects xtcallbackproc
pushed_fn
may compatible, isn't xtcallbackproc because uses xm types directly.
been while since i've done motif, wrong, solution might be:
void pushed_fn(widget w, xtpointer client, xtpointer cbsxt) { xmpushbuttoncallbackstruct *cbs = (xmpushbuttoncallbackstruct*)cbsxt; ... }
Comments
Post a Comment